Skip to content

Instantly share code, notes, and snippets.

@wpflippercode
Created September 27, 2016 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpflippercode/6e2b43fe7b622de8d81e7199cafc237e to your computer and use it in GitHub Desktop.
Save wpflippercode/6e2b43fe7b622de8d81e7199cafc237e to your computer and use it in GitHub Desktop.
Use own listing html with WP Posts Pro Plugin
add_filter('wpp_layout_modifier', 'wpp_layout_modifier', 10, 2);
function wpp_layout_modifier( $layout_content,$post_id ) {
// Define your own html here and use placeholders e.g {title}, {date} etc.
$layout_content = '<div class="wpp_post" itemscope="" itemtype="http://schema.org/Article">
{title}
<div class="wpp_meta">
<span class="wpp_date">{date}</span>
<span class="wpp_author">{author}</span>
<span class="wpp_comments">{comments}</span>
</div>
<div class="wpp_image">
{thumbnail} {content}
<div class="wpp_caption">
<div class="wpp_readmore">{read_more}</div>
<div class="wpp_taxonomy">
<div class="wpp_category">{categories}</div>
<div class="wpp_tags">{tags}</div>
</div>
</div>
</div>
</div>';
return $layout_content;
}
@wpflippercode
Copy link
Author

wpflippercode commented Sep 27, 2016

You can use wpp_layout_modifier hook to apply your own design in wp posts pro plugin. Below are the placeholders you can use in your html.

  • Post Title :{title}
  • Post Links :{post_link}
  • Post Content :{content}
  • Featured Image :{thumbnail}
  • Read More Link :{read_more}
  • Post Date :{date}
  • Author Name :{author}
  • Post Comments :{comments}
  • Post Categories :{categories}
  • Post Tags :{tags}
  • Custom Fields :{%custom_field_name%}
  • Taxonomy :{taxonomy=taxonomy_slug_here}
  • Title without link :{raw_title}
  • Author without link :{raw_author}
  • Author Url :{author_src}
  • Site Url :{site_url}
  • Template Path :{template_url}
  • Featured Image Url :{thumbnail_src}
  • Post Date Without Formatting :{raw_date}
  • Total Views :{view_count}

You need to define this hook in functions.php of your activated theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment