New Landing How can we help? Themeforest Theme Support Dante How do I add php in Swift Page Builder?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Posted in: Dante
  • #62226
    greghuntoon
    Member
    Post count: 10

    I have tried adding php code into both the Raw HTML and Text elements, to no avail. I’m taking code directly from WordPress’s codex, that I know to work in other cases, and using pastie.com to make sure the code is formatted cleanly.

    The output invariably comes out like the screenshot I’ve attached.

    Here is the code:

    <h3 class="spb-heading">Press</h3>
    <ul>
    <?php
    	$args = array( 'numberposts' => '5' );
    	$recent_posts = wp_get_recent_posts( $args );
    	foreach( $recent_posts as $recent ){
    		echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';
    	}
    ?>
    </ul>

    Thanks,
    Greg

    #62495
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    You can’t add php to the raw html element, this only supports html (hence the name). If you want to add php to the editor, you will have to install a plugin.

    – Kyle

    #62944
    greghuntoon
    Member
    Post count: 10

    Thanks Kyle. I guess I’ll be adding this to the feature request list, as I’m not sure how adding a plugin will help me on pages that I’m using the Swift Page Builder.

    Thanks,
    Greg

    #63002
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Why would it not? I use a plugin called Insert PHP Code Snippet and it works great, you set up your php code in the settings and it gives you a shortcode to add to your text box.

    – Kyle

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register