Archived topic
Some improvements if possible
8 replies · Started by JOAQUIM GALANTE on May 15, 2020
Hi, i am very pleased for your help and with the potentiality of the theme GeneratePress.
Now i ask for the last things to improve the site if it is possible :
1. Put my language flags and insert a current date in a top header bar ?
2. Put a Breaking News Section above featured grid ?
3. Put another Featured News Category Caroussel Slider between Featured Grid and the Frontpage ?
I don't know if it is possible to be add to the the theme
Thanks a lot
Hi there,
1. You can move your Language Widget to the Top bar widget area.
To display the current date - Tom provides the code to create a shortcode here:
https://generatepress.com/forums/topic/shortcode-for-current-date/#post-632065
You can use that to add the date to a HTML widget in the top bar.
2. and 3. You can add use the Hook Element to insert content into the site:
https://docs.generatepress.com/article/generate_hook_element_display/
The after_header hook can be used to place elements after your site header and navigation.
Hi David, When i put the clock code on 'CSS aditional' all code letters stay red
Sorry for the my last comment.
David i put the code
add_shortcode( 'custom_date', function() {
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified" style="display:none;">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
$date = sprintf( '%3$s',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
$time_string
);
return $date;
} );
in the HTML Widget and nothing happens.
Say 'Please use tab for identation'.
That code is PHP.
It goes in either your Child Theme functions.php or use the Code Snippets plugin.
More info:
https://docs.generatepress.com/article/adding-php/
Once that is added you add this to your widget:
[custom_date]
David, when i put the php code on a create plugin and activate it a message say 'Fatal error'.
Install the Code Snippets plugin:
https://en-gb.wordpress.org/plugins/code-snippets/
And Copy the code from here:
https://generatepress.com/forums/topic/shortcode-for-current-date/#post-632065
Then paste the code in Code Snippets
I have problem David, once i installed this program and i puted a code when activated i must to recover the site because a fatal error appear, since then always i install the Code Snippets plugin and activate it a fatal error occurs.
I use Pluginception