Single posts & in_the_loop

Posted in: Newsmag
Post count: 3

Hello,

I am attempting to use the WP filter “the_title” to add content to the title on single posts. However, I am having trouble selecting just the post loop.

Without any conditionals, the_title is selecting all the items on the page, including the menu items and the posts inside the mega menu.

Using the conditional “in_the_loop” should select just the single post, but it doesn’t.

Here is the code I am using:


if (in_the_loop()) :

$title = $meta_value . $title;
endif;

return $title;

This doesn’t affect anything on the page, including the single post.

I have also tried is_main_query, but that selects everything, including the menu items and the posts inside the mega menu.

Please advise.

Post count: 23312

Hello peconiconline,

Unfortunately, your request involve doing some additional customization through the code in order to bring best results and notice that we cannot afford to do this because we cannot provide any custom services at the moment, sorry! If you want to display more levels in our theme and if you are not aware of the steps which are needed to take in this regard, please consider hiring a freelancer/developer to help you!

Thanks for the message!

Post count: 3

I am a developer, and I paid for support with this theme. I am simply asking if there any conditionals that will select single posts in this theme, since the core WordPress ones are not working.

Is this because single posts are created through an instance of td_single_module_base, rather than a standard WP Query?

Post count: 23312

Hello peconiconline,

Please notice that the entire function which creates the title posts is get_title and it is located in td_module_single_base.php core file, like this -> https://www.screencast.com/t/Q90A74w6zr So, this function is called back for each post template used by you in loop-single, according to your post style used by you. For example, if you are using the post template style 1, the title for this post is called in loop-single-1.php, like this -> https://www.screencast.com/t/K3e03wpy

Thanks for your understanding!

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