Site logo

Archived topic

Automatically adding shortcode underneath post title

8 replies · Started by Mike on August 30, 2017

Viewing posts 1–9 of 9

Hello,

Is it possible to automatically add a shortcode just underneath my posts titles? So whenever I create a blog post it automatically adds another line underneath the title which contains a shortcode?

Thanks,
Mike

Hello,

Thanks for the response! Is there any way I can make this appear above the date and autor info?

Thanks,
Mike

Hello,

I already managed to achive this with a bit of playing about. This is what I came up with,

<?php if ( in_category('news') ) { ?>
<?php if ( is_single() ) { ?>
<h2>[wpbitly]</h2>

<?php } ?>
<?php } ?>

I also added an extra line of code to check the category first. I then simply had to disable the other byline elements in the customizer and voila!

Thanks!

Glad you found the solution! Thanks for sharing :)

I have several Categories and want to title the single posts with a title belonging to the category the post is under.
I used this condition and it works fine the main post page. 'latest-publications' is the category.

<?php if ( is_category ('latest-publications') ) : ?>
Content in all single post pages
<?php } ?>

I am having trouble making this condition work for all of the single posts in the 'latest-publication' posts.

<?php if ( is_single() ) { ?>
Content in all single post pages
<?php } ?>

Any help is appreciated.

Try:

<?php if ( is_single() && in_category( 'latest-publications' ) ) { ?>

<?php } ?>

Tom, I bow down to you. That did the trick.

Thank you so much!!

You're welcome! :)

This archived topic is closed to new replies.