Custom single.php override by cloud template

Posted in: Newspaper
Post count: 28

Hello world

Within the Newspaper theme there is a single.php page in my child-theme. The single page contains some extra php to filter ads depending what category they are in. For the default post template this is working fine.

When I create a template from a cloud based template and activate that in theme settings to display my single post, could you possible indicate to me, what “single.php override” file can be created for use or is this page dynamically created – the challenge is that the “if elseif” statements no longer fire and the related articles in the footer also no longer are visible.

  • This topic was modified 3 years by mediax.
Post count: 21065

Hello @mediax!

The cloud templates do not have PHP files because they are stored in the database as custom post types.

Thank you!

Post count: 28

Thanks for your reply Bettina

In that case, is there any way to add the “related posts” back into the base of the single post page? And is there any way that I can hook into the cloud template, to execute the PHP advert code in the single page?

Post count: 21065

Hello @mediax!

For flex blocks, there are some special filters for single template. Read all about it here: https://forum.tagdiv.com/flex-block-settings-guide/

Thank you!

Post count: 28

Hello and thanks for the reply.

Thus far I have tried using the add_filter( ‘the_content’, ‘update_post_views’ ); filter – this with success. However – it places the added content right at the start of the Output – ABOVE the TOP MENU ..

Is there any Theme Hook I can use to place the content – either after the main menu or before the TITLE output?

Post count: 21065

Hello @mediax!

Unfortunately, no.

Thank you!

Post count: 28

I suppose then if you are using cloud templates there is also no way to have the related post section in the base of the single output.

A bit of a blunt option isn’t?

Post count: 21065

Hello @mediax!

For example, add a flex block in a post, go to the filter tab of the element’s settings, and from the dropdown category filter, you can choose between: Single – More from author, Single – Related by category, Single – Related from tags.
So, for example, “Related from tags” is displaying articles/posts that have the same tags as the one you are currently viewing. You can also select Related and sort it as Random, for example.
Please keep in mind that in order for the flex block to work, it must be placed in a post template.
You can build a sidebar with the TagDiv Composer. Steps:
1. Insert one new row (or delete an existing one).
2. Divide into two columns (2/3 + 1/3).
3. You can add whatever element you want into the second column and consider it a sidebar.

If you do not mean this, then please let me know exactly, with more information (screenshots or videos), what you need to achieve there, so I can help you efficiently.

Thank you!

Post count: 28

Hello Bettina

Yes this did help tremendously, thank you. The single post cloud template is now with Related articles.

Please will you upscale the request regarding a filter or action hook that can be use in the cloud template output. (using the default blank template for Single) This was edited and then a Mobile template was created from that content.

The problem for me is – as you have mentioned, that the cloud template is stored in the database. There is no option to do any overrides in the child-theme.

For that reason, the only option then is to use an action or filter hook to adjust content.

Adding the PHP script via shortcode (Insert PHP Code Snippet) / using the theme shortcode block – this did not have any results.

What the script does is filter the correct advert for that category and insert that advert into the post.

Could you perhaps suggest any options that I am not seeing here?

Thank you!

Post count: 21065

Hello @mediax!

Unfortunately, this is not possible with cloud templates.

Thank you!

Post count: 28

Hello Bettina

Thank you for your great support and time spent helping with this issue.

There was a way in the end and my posts are now displaying the adverts correctly 🙂

Best wishes

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