Community Forums › Forums › Archived Forums › General Discussion › Change Position of Title to below Featured Image
- This topic has 8 replies, 4 voices, and was last updated 11 years, 7 months ago by
anouktapper.
-
AuthorPosts
-
June 24, 2013 at 7:36 am #47451
Zach Russell
MemberThe site i'm working on is Safety Warehouse
When the title of a portfolio item, which is currently the front-page is too long (more than one line) it makes the alignment off of images. A solution to this would be to move the titles below the featured image. This can't be acheived with this, I tried adding this to the beginning of my front-page.php:
remove_action( 'genesis_post_content', 'genesis_do_post_image' ); add_action( 'genesis_before_post_title', 'genesis_do_post_image' );
I'd appreciate any help you can offer me.
———-
Zach Russell
President, ProTech Internet GroupJune 24, 2013 at 7:36 pm #47598Derek
MemberYou've got the code right, but you need to use it in your functions.php file.
If you want to only move the titles below the images on the front page, you could use a conditional statement in your functions.php file:
/** Move image above post title on Front Page */ add_action( 'genesis_before_loop', 'move_image_front_page' ); function move_image_front_page() { if( is_front_page() ) : remove_action( 'genesis_post_content', 'genesis_do_post_image' ); add_action( 'genesis_before_post_title', 'genesis_do_post_image' ); endif; }
The only thing I'm not 100% sure on with that code is using the "genesis_before_loop" hook. It worked when I tested it, but I'm not sure it's the best hook to use in this scenario.
Derek Rippe – CSS Artist & Genesis Fanboy @ SynaVista and MediaCairn Design Studio
Figure out your CSS problems with Firebug | Check out my Custom Comment Form Title pluginJuly 26, 2013 at 1:32 pm #52645anouktapper
MemberI'm using Crystal theme and I'd like to move the post titles BELOW the featured images on the portfolio page. I can remove it, and double it, but i can't seem to move it below. Adding the code above to the functions.php file didn't do anything.
Should I edit functions.php AND portfolio_page.php, and if so what goes where - thanks much.July 31, 2013 at 11:04 pm #53499Derek
MemberAnouktapper,
The code above wouldn't work if you copied it verbatim because there is an if/else statement in there to only apply the actions to the front page. If you want it to work sitewide you might try:
/** Move image above post title on Front Page */ add_action( 'genesis_before_loop', 'move_featured_image' ); function move_featured_image() { remove_action( 'genesis_post_content', 'genesis_do_post_image' ); add_action( 'genesis_before_post_title', 'genesis_do_post_image' ); }
Derek Rippe – CSS Artist & Genesis Fanboy @ SynaVista and MediaCairn Design Studio
Figure out your CSS problems with Firebug | Check out my Custom Comment Form Title pluginAugust 1, 2013 at 12:01 am #53509Brad Dalton
ParticipantTo answer the original question from Zach Russell, you can simply change the hook on line 22 of your archive-portfolio.php file:
/** Add the featured image after post title */ add_action( 'genesis_before_post_title', 'executive_portfolio_grid' ); function executive_portfolio_grid() { if ( has_post_thumbnail() ){ echo '<div class="portfolio-featured-image">'; echo '<a>'; echo get_the_post_thumbnail($thumbnail->ID, 'portfolio' ); echo '</a>'; echo '</div>'; } }
That's the easiest way to do it.
Or you could use it in a custom function with conditional tag for the front page:
https://gist.github.com/braddalton/6128738
August 1, 2013 at 12:20 am #53510Brad Dalton
Participant@anouktapper Another way to do this is to add the code to reposition the portfolio archive image to your portfolio_page.php file.
remove_action( 'genesis_post_content', 'genesis_do_post_image' ); add_action( 'genesis_before_post_title', 'genesis_do_post_image' );
August 26, 2013 at 3:12 pm #58913anouktapper
MemberThanks Brad - While this does add a post thumbnail above the post title of the portfolio page, it still leaves a portfolio thumbnail below the title, so it makes double thumbnail images for each post on the portfolio page. If I could remove the thumbnail image then it would look right. Here's the page: http://frictioninc.com/projects/
August 26, 2013 at 6:02 pm #58946Brad Dalton
Participant@anouktapper Which solution are you referring too? I posted 3.
Couldn't access your site. Seems very slow to load.
August 28, 2013 at 10:48 am #59241anouktapper
MemberI was referring to #53510, but the same thing happened with #53499.
(I know my site is slow, i need to deal with it but I just too slammed with other projects to upgrade my own website, stupid.) -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.