Tuesday, 27 October 2015

Wordpress page with image template

1:This code is to use in Wordpress template to get page content,title with featured image. 2:<div class="head-black"> // Use you own heading(title) class 3:<i class="fa fa-calendar"></i> // This code is to show icon (fortawesome : https://fortawesome.github.io/Font-Awesome/) 4:$page_id = 35 // use your page id 5:<div class="col-md-8"> //this is bootstrap coloumn code
<!--php /* Template Name: Indoors meets Outdoors */ ?--> <!--php $page_id = 35; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123. $page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. By default, this will return an object. //This is used to display thumbnail image echo ' <div class="thumbnail-box "-->'.get_the_post_thumbnail( $page_id, 'full' ).'</div>'; //This is used to display Heading echo '<div class="head-black"><h3> <i class="fa fa-calendar"></i> '. $page_data->post_title .'</h3></div>';// echo the title //This is used to display Content echo'<div class="box-green">'. substr(apply_filters('the_content', $page_data->post_content),0,1400).'<div class="link-box">'.'<div class="col-md-8"></div>'.'<div class="col-md-4">'.'<div class="link-left"><a href="&#39;.post_permalink( $page_id ).&#39;">Read More</a></div>'.'</div>'.'</div>'.' </div>'; // echo the content and retain WordPress filters such as paragraph tags. ?>

Share

& Comment

1 comments:


  1. Hello,

    we provide affordable and result-oriented SEO services, please give a chance to serve you.


    Thanks
    Admin: E07.net

    ReplyDelete

 

Copyright © Taha Codes™ is a registered trademark.