Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #689347

    I want to add a Title field to the VIDEO content element in the AVIA Layout Builder. The TITLE attribute will need to be added to the iframe tag that the Avia Layout Builder is generating.

    I have created a new content element by copying the VIDEO content element and renaming it by following instructions from various posts on creating or altering content elements in the AVIA Layout Builder.

    Where in the code will I add the TITLE field?
    Where in the code will I alter the HTML output to include the TITLE attribute and the value entered into the form?

    Thanks

    #689480

    I found a solution. Please let me know if there is a better way…
    I copied the video.php file from the shortcodes folder into a shortcodes folder I created in my child theme.

    I added a new item to the array of fields.

    array(	
    	"name" 	=> __("Title", 'avia_framework' ),
    	"desc" 	=> __("Enter a value for the iframe Title attribute", 'avia_framework' ),
    	"id" 	=> "iframetitle",
    	"type" 	=> "input",
    	"std" 	=> "Enter a title"
    ),

    After this line:
    $output = $wp_embed->run_shortcode("[embed]".trim($src)."[/embed]");

    I added this line in order to insert my attribute into the $wp_embed code.
    $output = str_replace('></iframe>', ' title="' . trim($iframetitle) . '"></iframe>', $output);

    Seems to do what I need it to. But maybe there’s a better way…

    • This reply was modified 8 years, 2 months ago by galpinr.
    #690072

    Hi,

    Great, glad you found a solution and thanks for sharing. I don’t see any problem with your solution, as long as it’s working :-)

    Best regards,
    Rikard

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.