Tagged: child theme, entry-title, featured image
- This topic has 6 replies, 2 voices, and was last updated 10 years, 3 months ago by
Sakin.
-
AuthorPosts
-
July 3, 2015 at 5:57 am #60491
heather
ParticipantHello,
Thanks for a great theme. I am trying to move the page title (header.entry-header) into the div containing the featured image (div#header-featured-image) so that I can have it show on top of the image (using position relative on the image div and absolute on the entry title). I am not super familiar with using hooks and could use some pointers about where I can do this. I am working on a child theme.How would you recommend I go about this?
July 3, 2015 at 10:02 am #60492Sakin
Keymaster@heather: You can just copy
fullframe_archive_content_image()function fromfullframe-core.phpfile to your child themefunctions.phpfile and then add in Title as per your need. Then you can copycontent.phpto your child theme and remove title from there.July 3, 2015 at 11:29 pm #60516heather
ParticipantThanks much.
I have don’t quite have it working though. Wouldn’t I also need to include the area that directs the output for the <div id=”header-featured-image”> ? so that I can place my title within it? Also I found that I needed to edit not just content.php but also content-page.php and content-single.php to remove the title from the content area across the site.Am I missing something about the archive image function? When I include my title code there nothing is output to the html. I did find the call for the div in fullframe-custom-header.php and tried moving those functions into my child theme functions.php but I am still not able to render the title tag.
Any further advice?
Thanks
hgmJuly 4, 2015 at 12:26 pm #60528Sakin
Keymaster@heather: Oh in your are looking to change single post/page. Then yes, you need to edit content-single.php and content-page.php file. Then you need to copy function
fullframe_featured_page_post_image()to your child theme and functions.php file and add the following code where you want to show title.
<h1 class="entry-title">' . get_the_title(). '</h1>'
Maybe you can just add it after
$fullframe_featured_image = '<div id="header-featured-image" class =' . $featured_image_size . '>July 5, 2015 at 3:34 am #60537heather
ParticipantYep. That did the trick perfectly – thanks!
July 16, 2015 at 1:21 am #61057heather
ParticipantHi,
I am finding that this only works if I designate a specific image and when the theme uses the default no H1 is output. Approximately 70% of the site pages use a unique header image but the rest rely on the fallback so sorting this out would be a big help. I suspect I either need to move where I have the H1 call or add it somewhere else where the default is output. Also I want to add a couple more bits to this area so getting my head around where things over the image should be in the functions is key.Settings:
Customize> Header Image: Entire Site, Page/Post Featured Image
Featured Header Image Position: After Secondary Menu (I’m not using one)My Functions code in child theme:
if ( ! function_exists( 'fullframe_archive_content_image' ) ) : /** * Template for Featured Image in Archive Content * * To override this in a child theme * simply create your own fullframe_archive_content_image(), and that function will be used instead. * * @since Full Frame 1.0 */ function fullframe_archive_content_image() { $options = fullframe_get_theme_options(); $featured_image = $options['content_layout']; if ( has_post_thumbnail() && 'full-content' != $featured_image ) { ?> <header class="entry-header"> <h1 class="entry-title"> <a>" rel="bookmark"> <?php the_title(); ?> </a> </h1> </header> <!-- .entry-header --> <figure class="featured-image"> <a rel="bookmark">"> <?php if ( $featured_image == 'excerpt-image-left' || $featured_image == 'excerpt-image-right' ) { the_post_thumbnail( 'fullframe-featured-content' ); } elseif ( $featured_image == 'excerpt-image-top' ) { the_post_thumbnail( 'fullframe-featured' ); } elseif ( $featured_image == 'excerpt-full-image' ) { the_post_thumbnail( 'full' ); } ?> </a> </figure> <?php } } endif; //fullframe_archive_content_image add_action( 'fullframe_before_entry_container', 'fullframe_archive_content_image', 10 ); if ( ! function_exists( 'fullframe_featured_page_post_image' ) ) : /** * Template for Featured Header Image from Post and Page * * To override this in a child theme * simply create your own fullframe_featured_imaage_pagepost(), and that function will be used instead. * * @since Full Frame 1.0 */ function fullframe_featured_page_post_image() { global $post, $wp_query; // Get Page ID outside Loop $page_id = $wp_query->get_queried_object_id(); $page_for_posts = get_option('page_for_posts'); if ( is_home() && $page_for_posts == $page_id ) { $header_page_id = $page_id; } else { $header_page_id = $post->ID; } if( has_post_thumbnail( $header_page_id ) ) { $options = fullframe_get_theme_options(); $featured_header_image_url = $options['featured_header_image_url']; $featured_header_image_base = $options['featured_header_image_base']; if ( '' != $featured_header_image_url ) { //support for qtranslate custom link if ( function_exists( 'qtrans_convertURL' ) ) { $link = qtrans_convertURL( $featured_header_image_url ); } else { $link = esc_url( $featured_header_image_url ); } //Checking Link Target if ( '1' == $featured_header_image_base ) { $target = '_blank'; } else { $target = '_self'; } } else { $link = ''; $target = ''; } $featured_header_image_alt = $options['featured_header_image_alt']; // Header Image Title/Alt if ( '' != $featured_header_image_alt ) { $title = esc_attr( $featured_header_image_alt ); } else { $title = ''; } $featured_image_size = $options['featured_image_size']; if ( 'slider' == $featured_image_size ) { $feat_image = get_the_post_thumbnail( $post->ID, 'fullframe-slider', array('id' => 'main-feat-img')); } else if ( 'full' == $featured_image_size ) { $feat_image = get_the_post_thumbnail( $post->ID, 'full', array('id' => 'main-feat-img')); } else { $feat_image = get_the_post_thumbnail( $post->ID, 'fullframe-large', array('id' => 'main-feat-img')); } $fullframe_featured_image = '<div id="header-featured-image" class =' . $featured_image_size . '>'; // Header Image Link if ( '' != $featured_header_image_url ) : $fullframe_featured_image .= '<a title="'. esc_attr( $title ).'" href="'. esc_url( $link ) .'" target="'.$target.'">' . $feat_image . '</a>'; else: // if empty featured_header_image on theme options, display default $fullframe_featured_image .= $feat_image; endif; $fullframe_featured_image .= '<header class="entry-header"><h1 class="entry-title">' . get_the_title(). '</h1></header></div><!-- #header-featured-image -->'; echo $fullframe_featured_image; } else { fullframe_featured_image(); } } // fullframe_featured_page_post_image endif; add_action( 'fullframe_before', 'fullframe_featured_image_display' );Thanks again for getting me this far, hoping you can help me finish this too.
July 17, 2015 at 7:25 am #61121 -
AuthorPosts
- The topic ‘Place page title over featured image’ is closed to new replies.
