Archived topic
I get unwantet when I use your theme.
7 replies · Started by ER on June 22, 2022
I found this:
If you instead wish to prevent WordPress from adding <p> tags on both pages, posts and all other post types, you can simply remove the if ( is_singular( 'page' ) ) statement, like this:
// Prevent WP from adding <p> tags on all post types
function disable_wp_auto_p( $content ) {
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
return $content;
}
add_filter( 'the_content', 'disable_wp_auto_p', 0 );
Where should I added when using your theme. Is there some other code I can add?
Hi ER,
That code is PHP.
If you’re using a Child theme, you can add it via the functions.php but if you’re using the Parent GP theme, you’ll need a plugin like Code snippets.
Here’s are reference to adding PHP code:https://docs.generatepress.com/article/adding-php/#code-snippets
Kindly make sure the the quotation marks in your code are straight when adding them to your site as copying and pasting sometimes makes the quotation marks slanted. This will cause an issue or make the code not work if not corrected.
Hope this clarifies!
I downloaded the plugin. Do you know how to use it?
Can I found it somewhere in dashboard?
In your admin dashboard, go to Snippets > Add new. From there, you’ll be able to add your PHP snippet.
Example: https://share.getcloudapp.com/BluGYDlm
Hope this helps!
Hi. I don't see any "snippets" on my dashboard.
Have you activated the plugin Code Snippets after installing it?
I found plugin here: Here’s are re
ference to adding PHP code:https://docs.generatepress.com/article/adding-php/#code-snippets
Took the wrong one, now I have snippets and see it on my dashboard.
I still get <p> when I don't want.
is there other code to add?
I added the code I showed you to new snippet.
Could you provide a link to a sample page where you’re trying to implement this, and can you identify the specific p tags which aren’t removed?
You may use the private information field to share your credentials: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Hope to hear from you soon.