• I have the following code on my site:

    <div style="margin-top:30px;margin-bottom:30px">[wpseo_breadcrumb]</div>
    
    <?php the_title( '<h1>', '</h1>' ); ?>

    It places a breadcrumb menu and the page title where I want it and works well.

    The issue is that I don’t want that to be used for posts. I handle the layout of posts differently and the above code interferes with that layout.

    Is there something I can add to that to force it to be ignored only on posts, and work as intended for pages?

Viewing 2 replies - 1 through 2 (of 2 total)
  • try if($post->post_type == 'page') { /** your code **/ }

    Thread Starter smackbomb

    (@smackbomb)

    Thank you for that! For some reason it is displaying the code you posted but parsing the original code – in other words, it is still displaying what I put in the “your code” area but also the PHP code around it as text.

    Is there something I need to add to prevent that from happening?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to prevent this code from being used on Posts?’ is closed to new replies.