Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove Action for genesis_custom_loop entries but not page template
Tagged: blog page, page_blog.php
- This topic has 8 replies, 4 voices, and was last updated 7 years, 3 months ago by Ignatlenivec.
-
AuthorPosts
-
December 21, 2016 at 5:46 am #197936GSmith84Member
I don't like replacing the genesis loop entirely unless I have to do heavy customization. I wanted to know if there was a way to target post entries with genesis hooks outside of the page template its on. An example being I re-position the entry title for the Page Template but don't want that to carry over to the loop returned posts and / or remove the entry content of the loop posts but not the actual page entry.
eg: A Blog Listing Template
(Have this only affect the Page Template Title)
//* Re-position Header remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); add_action( 'genesis_before_content', 'genesis_do_post_title' );
(Have this only affect the Post Entry Titles)
//* Remove the post content (requires HTML5 theme support) remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
December 21, 2016 at 8:00 am #197942Victor FontModeratorYou need to use WordPress conditions like is_page(), is_single(), or is_singular(). Wrap your code in the appropriate one of these conditionals to target pages or posts.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?December 22, 2016 at 9:34 am #198006GSmith84MemberI appreciate the response, unfortunately that really isn't what I'm going for. I was hoping to create a Blog Page that instead of show all the content of each post only shows the featured image and the title. I could always just display:none the content but I would need to re-position the default title / image genesis loop outputs. I'll just have to customize it completely, I was just curious if there was a way to target those separate of the page.
December 23, 2016 at 9:05 pm #198063Brad DaltonParticipant1. Copy over the archive-portfolio.php file from the Executive Pro child theme
2. Rename it page_blog.php and add a page template header//* Template Name: Blog
3. Remove the code in the file which forces a full width content layout and remove the code which adds the custom body class.
This will display the title and featured image on the blog page.
December 28, 2016 at 5:50 pm #198394IgnatlenivecMemberhi. i need to do the same thing - in a sample theme to relocate the header of each post inside the entry-contend and don't show content or excerpts, only the image, the title inside and (!) "Read more..." in my language. and i need to do this without changing files of root genesis, only for child theme and for this blog page only.
but how? i understand that i can use smth like is_page(id) in main genesis loop but seriously? i'll not so gracefully how i want and for what i've bought so cool framework(
December 29, 2016 at 12:47 am #198400Brad DaltonParticipantDecember 29, 2016 at 7:51 am #198409IgnatlenivecMemberthanks, brad. realy interesting second link, i start to understand how genesis is versatile and will try all of these things.
but i don't see the way to place header inside entry-content BEFORE content itself. or can i place featured image outside of the entry-content and before content-header? i need smth like this:
and i was so glad when read about conditional tags for hooks like
if ( ! is_single() ) { remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); }
but it's not work for me for unknown reason, it's just disable content totally, not only for blog page.
December 29, 2016 at 8:09 am #198410Brad DaltonParticipantI assume you want to reposition the entry header including the title and post meta to the entry content hook on single post only.
add_action( 'loop_start', 'your_function' ); function your_function() { if ( ! is_singular( 'post' ) ) return; remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); add_action( 'genesis_entry_content', 'genesis_entry_header_markup_open', 1 ); add_action( 'genesis_entry_content', 'genesis_do_post_title', 2 ); add_action( 'genesis_entry_content', 'genesis_post_info', 3 ); add_action( 'genesis_entry_content', 'genesis_entry_header_markup_close', 4 ); }
December 29, 2016 at 12:37 pm #198437IgnatlenivecMemberthank you so much, i'll try it all today-tomorrow once again. now it's work but without conditionals. it's just execute the hooks but everywhere(
and i want to ask two questions. first is about these hooks instead simple php code like <?php the_title() ?> in templates. how slow or fast this method in context of server calls etc? i mean is this way not to slower than ordinary wp template markup? i see it's very versatile (if conditional tags will work) but it must not to do my sites slower i think.
and second: pay part of wpsites.net is not so cheap but can i pay for month and copy some articles in and for future? i know it's brazenly but... 🙂
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.