Archived topic
Text Before Post Listing At Homepage
9 replies · Started by max on November 4, 2020
Hi. How to put text at content area before post listing at homepage?
Please guide me
please check screenshot
Hi,
You can check our Hooks Visual Guide documentation for hooks you can use to place your text:
https://docs.generatepress.com/article/hooks-visual-guide/
We then add the desired text using a Hook Element found on Dashboard > Appearance > Elements.
https://docs.generatepress.com/article/hooks-element-overview/
done
tq
No problem. Glad to be of any help. :)
sorry
we had problem
we want to appear the front page only
no at page 2, page 3 etc
In that case you would need this PHP snippet:
add_filter( 'generate_hook_element_display', function( $display, $element_id ) {
if ( 123 === $element_id && is_paged() ) {
$display = false;
}
return $display;
}, 10, 2 );
Adding PHP: https://docs.generatepress.com/article/adding-php/
Replace 123 with the actual element ID.
We will be adding this in the display rules in the next version of GP Premium :)
sorry i didn' understand
need to install plugin?
sorry i didn’ understand
need to install plugin?
To add Leo's PHP snippet, you either use a child theme and add the snippet on its functions.php
Or
If you don't want to use a Child theme, you can install the Code Snippets plugin to be able to run the PHP snippet.
Adding PHP:https://docs.generatepress.com/article/adding-php/
1) where to get child theme?
2) and we need to activate full theme & child theme? and set primary for child theme?
Here's brief documentation about using child theme/s.
https://docs.generatepress.com/article/using-child-theme/
Note: Using a code snippet plugin maybe more practical if you have no idea how child themes work.
Code Snippets plugin is pretty lightweight so you don't have to worry about it adding bloat.
https://wordpress.org/plugins/code-snippets/