How to build a custom post template?

Posted in: Newspaper
Post count: 1

I want to build a post template without ads, but only for some articles. How can I create it?

Post count: 7909

Hi,

The articles ads are placed in the content(get_content function), and the function is defined here – http://screencast.com/t/VQCmUU7Y This function is used in post templates – http://screencast.com/t/8EyWM8dCb
You can add a condition to block them on a specific post using is_single() function, check this topic as reference – https://forum.tagdiv.com/topic/disable-ads-on-particular-posts/
If you want to remove all the ads from your post(including header), you can try to add a condition like this(just add you post ID) – http://screencast.com/t/Yo7c5lffhOfN

if(!is_single('ID'))

You can read more about is_single function here – https://codex.wordpress.org/Function_Reference/is_single

To create a post template, please take a look at theme templates(loop and single) and use that structure, please check the official documentation – https://codex.wordpress.org/Post_Types#Custom_Post_Type_Templates

Thanks!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.