Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] Flip Menu and Page Header

Home Forums Support Flip Menu and Page Header

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #143720
    Bryn

    Is it possible to place the page header above the menu? I just want to reverse the two.

    http://julesknowlton.com/

    ALSO, is it possible to assign a custom page header for category pages?

    #143766
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Give this PHP a try:

    add_action('after_setup_theme','generate_change_nav_position');
    function generate_change_nav_position()
    {
          remove_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 );
          add_action( 'generate_after_header', 'generate_add_navigation_after_header', 29 );
    }

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    As for adding a page header to the category pages:

    You can use WordPress conditionals in the hooks to tell content to show up on certain pages. For example, if you want your page header to be displayed below your header on category pages, you would add something like this to your “After Header” hook in “GP Hooks”:

    https://codex.wordpress.org/Function_Reference/is_category

    <?php if ( is_category() ) : ?>
          <div class="page-header-image grid-container grid-parent generate-page-header">
                <img src="URL TO YOUR CATEGORY HEADER IMAGE" alt="" itemprop="image">
          </div>
    <?php endif; ?>

    For specific categories, you would do something like this using the category name:

    <?php if ( is_category( 'Category Name' ) ) : ?>
          <div class="page-header-image grid-container grid-parent generate-page-header">
                <img src="URL TO YOUR CATEGORY HEADER IMAGE" alt="" itemprop="image">
          </div>
    <?php endif; ?>

    Hope this helps 🙂

    #143771
    Bryn

    The PHP to change the header/menu positions isn’t working.

    As for the category images, I simply want to set a custom page header for the page categories. Like here: http://julesknowlton.com/category/short-stories-and-poetry/

    #143856
    Tom
    Lead Developer
    Lead Developer

    How did you add the PHP? I just tested it and it worked as it should.

    That page is returning a 404.

    There’s no real way to set a page header for category pages, as they don’t have static pages that you can edit from the back-end – WordPress creates them for you.

    The best way is to use GP Hooks with the code I mentioned above.

    Let me know 🙂

    #143939
    Bryn

    Thanks! The header/menu flip worked when I created a plugin.

    However the PHP for the category image is returning an error:

    Parse error: syntax error, unexpected ‘<‘ in /home3/tlmpksuz/public_html/wp-content/plugins/category-image/category-image.php on line 12

    <?php if ( is_category( ‘Short Stories and Poetry’ ) ) : ?>

    <?php endif; ?>

    #143950
    bdbrown

    In the hook where you placed the code make sure the “Execute PHP” option is checked.

    #144005
    Tom
    Lead Developer
    Lead Developer

    Yea, that code should be added to GP Hooks in the “After Header” hook – not that category image plugin.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.