Exclude snippets from individual posts
-
Hello,
I have created snippets to supplement my posts with certain information. Is it possible to disable these snippets for individual posts in the Generate Press theme? Is there a code for this?
The code looks like this:
add_action('generate_after_entry_title', function(){ if(is_single()){ // Nur in Beiträgen zu sehen echo do_shortcode('Anzeige/Werbung'); } }); add_action('generate_after_entry_title', function(){ if(is_front_page()){ // Nur auf Übersichtsseiten zu sehen echo do_shortcode('Anzeige/Werbung'); } }); add_action('generate_after_entry_title', function(){ if(is_category()){ // Nur auf Kategorieseiten echo do_shortcode('Anzeige/Werbung'); } }); add_action('generate_after_entry_title', function(){ if(is_search()){ // Nur auf Suchseite (Seiten über Editor ausgeschlossen) echo do_shortcode('Anzeige/Werbung'); } });I would simply like to exclude individual targeted contributions.
Thx in advance.
-
Hi there,
Not sure I fully understand your question, the code below is specifically added for the single posts, if you don’t want it to apply to the single posts, simply remove it. Let me know if I miss anything 🙂
add_action('generate_after_entry_title', function(){ if(is_single()){ // Nur in Beiträgen zu sehen echo do_shortcode('Anzeige/Werbung'); } });The menu does not appear on my mobile page with GeneratePress:
https://neurinomavestibular.es/Hi @kurros,
It seems to be because of a plugin you have. Try disabling non GP-plugins to test.
Deactivating the LiteSpeed Cache plugin opens the menu on your mobile. I like this plugin. It is possible to keep it and fix the problem. Thank you.
Hi there,
please raise a new topic, so we can focus on your requirements without sending notices to the user who opened the topic.
Thank you for your reply. I wanted to exclude individual posts, not all. But now I found another solution.
The topic ‘Exclude snippets from individual posts’ is closed to new replies.
