** page.php **
** content-page.php **

WP PHP Tips

PHP small tips


WordPress PHP

Shortcode into PHP

Excellent bit of information here for converting a Worpress shortcode into php to place into a template:

<?php echo do_shortcode("[shortcode]"); ?>

From Chris Coyier. Where [shortcode] is your shortcode…

Note:If the shortcode contains double quotes (“) these will need to be single quotes inside the php.
contact-form-7 id="929" title="Changes form"
Change to:
contact-form-7 id='929' title='Changes form'

Or like this:

<?php do_action(‘slideshow_deploy’, ‘379’); ?>

Edit Post Links

To get the FP edit button to appear, only when logged in, on content blocks place this before the content shortcode int he PHP template. The Content box id needs to be places manually if outside of the loop.

<?php edit_post_link( $link, $before, $after, $id, $class ); ?>

$link – string… $id – integer

Adapted to look like:

<div class="edit-link"><?php edit_post_link( ‘<i class="fa fa-pencil-square-o fp-fa-edit"> </i>’,”,”, ‘921’ ); ?> </div>

Pull in content

To get the content into your page add this piece of php:

<?php if (have_posts()) : the_post(); the_content(); ?>

Done.
Fivepilchard Team fp_logo_green

Updated Mar 2017


Contact us for more information