- This topic has 6 replies, 3 voices, and was last updated 8 years, 6 months ago by Tom.
-
AuthorPosts
-
October 12, 2015 at 9:50 am #143720Bryn
Is it possible to place the page header above the menu? I just want to reverse the two.
ALSO, is it possible to assign a custom page header for category pages?
October 12, 2015 at 11:01 am #143766TomLead DeveloperLead DeveloperHi 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 ๐
October 12, 2015 at 11:11 am #143771BrynThe 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/
October 12, 2015 at 10:26 pm #143856TomLead DeveloperLead DeveloperHow 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 ๐
October 13, 2015 at 6:52 am #143939BrynThanks! 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; ?>
October 13, 2015 at 7:25 am #143950bdbrownIn the hook where you placed the code make sure the “Execute PHP” option is checked.
October 13, 2015 at 10:40 am #144005TomLead DeveloperLead DeveloperYea, that code should be added to GP Hooks in the “After Header” hook – not that category image plugin.
-
AuthorPosts
- You must be logged in to reply to this topic.