- This topic has 20 replies, 2 voices, and was last updated 7 years, 6 months ago by Tom.
-
AuthorPosts
-
August 31, 2016 at 3:44 pm #222891Ivan Cazorla
Hey Tom,
Theres any way to move the post’s date and category to the header, below the title? I show you a photo too:
http://es.tinypic.com/r/2lqj42/9
Thanks,
Ivan!September 1, 2016 at 12:10 am #222924TomLead DeveloperLead DeveloperHow are you getting the title up there?
September 1, 2016 at 1:29 am #222933Ivan CazorlaHey, I used the Page Header function and I disabled the “content title” with the Disable Elements GeneratePress Premium.
September 1, 2016 at 10:09 am #223039TomLead DeveloperLead DeveloperSo did you manually enter the title into the Page Header content?
September 1, 2016 at 12:19 pm #223069Ivan CazorlaExactly!! What should I do now?
September 1, 2016 at 11:38 pm #223195TomLead DeveloperLead DeveloperWell that way you would have to manually enter the meta content into the Page Header.
Or you could do it automatically:
add_filter( 'generate_show_title', 'generate_hide_single_title' ); function generate_hide_single_title() { if ( is_single() ) return false; return true; } add_action( 'after_setup_theme','generate_remove_posted_on' ); function generate_remove_posted_on() { remove_action( 'generate_after_entry_title', 'generate_post_meta' ); } add_action('generate_after_header','generate_add_post_title_below_header'); function generate_add_post_title_below_header() { // Add the single post IDs we want to target to the array below, separated by commas if ( is_single() ) : ?> <div class="page-header-content generate-page-header generate-content-header" style="background-image:url( <?php the_post_thumbnail_url(); ?> );background-size:cover;"> <div class="inside-page-header-container inside-content-header grid-container grid-parent"> <header class="entry-header"> <?php the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' ); ?> <div class="entry-meta"> <?php generate_posted_on(); ?> </div><!-- .entry-meta --> </header><!-- .entry-header --> </div> </div> <?php endif; }
Should get you started ๐
September 2, 2016 at 9:51 am #223329Ivan CazorlaThank you for the code but, where do I need to place this code?
Thanks,
Ivan
September 2, 2016 at 10:06 am #223333TomLead DeveloperLead DeveloperThis should help: https://generatepress.com/knowledgebase/adding-php-functions/
September 2, 2016 at 10:07 am #223334Ivan Cazorlathanks ๐
September 2, 2016 at 11:00 am #223348Ivan CazorlaIt worked, but… Now I have two page headers. How can I delete the first one?
http://es.tinypic.com/r/2nvw0g7/9
Thanks,
IvanSeptember 2, 2016 at 11:02 am #223349TomLead DeveloperLead DeveloperRemove it on the page itself (using the metabox).
You’ll also need to style the new one with CSS.
If that’s too much, the only other option is manually adding the title and post meta into the page header metabox.
September 2, 2016 at 11:09 am #223350Ivan CazorlaIf I do that now both Page Headers disapear :/ What am I doing wrong?
http://es.tinypic.com/r/vp97r6/9
Thanks,
IvanSeptember 2, 2016 at 11:10 am #223351TomLead DeveloperLead DeveloperInstead of disabling it, just remove the content from the content textbox in the Page Header metabox.
September 2, 2016 at 11:13 am #223353Ivan CazorlaI also tried that, but now I get a big image of the post, and my custom page header code below (and without the post image).
http://es.tinypic.com/r/fci51s/9
Thanks,
IvanSeptember 2, 2016 at 11:14 am #223354TomLead DeveloperLead DeveloperYou’ll want to remove the image like this:
.page-header-image-single { display: none; }
-
AuthorPosts
- You must be logged in to reply to this topic.