[Resolved] How to move date post to the header

Home Forums Support [Resolved] How to move date post to the header

Home Forums Support How to move date post to the header

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #222891
    Ivan 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!

    #222924
    Tom
    Lead Developer
    Lead Developer

    How are you getting the title up there?

    #222933
    Ivan Cazorla

    Hey, I used the Page Header function and I disabled the “content title” with the Disable Elements GeneratePress Premium.

    #223039
    Tom
    Lead Developer
    Lead Developer

    So did you manually enter the title into the Page Header content?

    #223069
    Ivan Cazorla

    Exactly!! What should I do now?

    #223195
    Tom
    Lead Developer
    Lead Developer

    Well 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 ๐Ÿ™‚

    #223329
    Ivan Cazorla

    Thank you for the code but, where do I need to place this code?

    Thanks,

    Ivan

    #223333
    Tom
    Lead Developer
    Lead Developer
    #223334
    Ivan Cazorla

    thanks ๐Ÿ™‚

    #223348
    Ivan Cazorla

    It worked, but… Now I have two page headers. How can I delete the first one?

    http://es.tinypic.com/r/2nvw0g7/9

    Thanks,
    Ivan

    #223349
    Tom
    Lead Developer
    Lead Developer

    Remove 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.

    #223350
    Ivan Cazorla

    If I do that now both Page Headers disapear :/ What am I doing wrong?

    http://es.tinypic.com/r/vp97r6/9

    Thanks,
    Ivan

    #223351
    Tom
    Lead Developer
    Lead Developer

    Instead of disabling it, just remove the content from the content textbox in the Page Header metabox.

    #223353
    Ivan Cazorla

    I 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,
    Ivan

    #223354
    Tom
    Lead Developer
    Lead Developer

    You’ll want to remove the image like this:

    .page-header-image-single {
        display: none;
    }
Viewing 15 posts - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.