Community Forums › Forums › Archived Forums › General Discussion › In Showcase Pro – move entry info after the title
Tagged: .post-info, entry-meta, Showcase Pro
- This topic has 7 replies, 2 voices, and was last updated 6 years, 1 month ago by
macrunner.
-
AuthorPosts
-
August 18, 2017 at 8:17 am #210512
macrunner
ParticipantHi,
I'm customizing the Showcase Pro theme.
In the functions.php file I have added some features that I then view through shortcodes and everything is working fine.function showcase_entry_meta_header($post_info) { $post_info = '[post_categories before="" after=" ·"] [post_date] [post_edit before=" · "] · Post of [word_count] words · View [postview]'; return $post_info; }
In the following picture you can see the edit that I would like to make: http://imgur.com/a/6u6er
In practice, I would like to move shortcodes just below the title.
To do this, I opened the single.php file that contains:
// Add page header add_action( 'genesis_after_header', 'showcase_single_page_header', 8 ); function showcase_single_page_header() { $output = false; $image = get_post_thumbnail_id(); if( $image ) { // Remove the title since we'll add it later remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); $image = wp_get_attachment_image_src( $image, 'showcase_hero' ); $background_image_class = 'with-background-image'; $title = the_title( '<h1>', '</h1>', false ); $output .= '<div class="page-header bg-primary with-background-image" style="background-image: url(' . $image[0] . ');"><div class="wrap">'; $output .= '<div class="header-content">' . $title . '</div>'; $output .= '</div></div>'; } if( $output ) echo $output; }
I have done many tests, I've followed many tutorials and guides but no positive results.
The site I'm working on: http://demo.maexen.com/dev/simple/
Thanks for any help or suggestion.
August 18, 2017 at 2:46 pm #210524Brad Dalton
ParticipantHi
This is the code to use to remove the post info https://my.studiopress.com/documentation/snippets/entry-header-html5/remove-entry-meta/
You can then add it back using any genesis hook
Not sure why you posted the code for the image?
August 18, 2017 at 11:33 pm #210532macrunner
ParticipantHi,
This is the original code that is in single.php and shows the image featured and over the Title:
add_action( 'genesis_after_header', 'showcase_single_page_header', 8 ); function showcase_single_page_header() { $output = false; $image = get_post_thumbnail_id(); if( $image ) { remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); $image = wp_get_attachment_image_src( $image, 'showcase_hero' ); $background_image_class = 'with-background-image'; $title = the_title( '<h1>', '</h1>', false ); $output .= '<div class="page-header bg-primary with-background-image" style="background-image: url(' . $image[0] . ');"><div class="wrap">'; $output .= '<div class="header-content">' . $title . '</div>'; $output .= '</div></div>'; } if( $output ) echo $output; }
I was thinking of this change:
add_action( 'genesis_after_header', 'showcase_single_page_header', 8 ); function showcase_single_page_header() { $output = false; $image = get_post_thumbnail_id(); if( $image ) { remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); $image = wp_get_attachment_image_src( $image, 'showcase_hero' ); $background_image_class = 'with-background-image'; $title = the_title( '<h1>', '</h1>', false ); $output .= '<div class="page-header bg-primary with-background-image" style="background-image: url(' . $image[0] . ');"><div class="wrap">'; $output .= '<div class="header-content">' . $title . '</div>'; // here, where I thought I would insert my shortcode, for example: $output .= '<div class="mycustomcss">' . '[post_categories before="" after=" ·"] [post_date] [postview]' . '</div>'; $output .= '</div></div>'; } if( $output ) echo $output; }
But showing the code shortcode, not the content, date, categories etc:
Post title
[shortcode 1] [shortcode 2]demo.maexen.com/dev/simple
Definitely I'm using wrong codes, i should understand how to enter shortcode here:
$output .= '<div class="mycustomcss">' . Here i would like to enter my shortcode . '</div>';
August 19, 2017 at 12:31 am #210534Brad Dalton
ParticipantAugust 19, 2017 at 1:42 am #210536macrunner
ParticipantI think the problem that I can not solve is that my code does not show the shortcode content:
$output .= '<div class="mycustomcss">' . '[post_categories before="" after=" ·"] [post_date] [postview]' . '</div>';
I do not know how to show my shortcode in $output .=
August 19, 2017 at 2:03 am #210537Brad Dalton
ParticipantAugust 19, 2017 at 3:01 am #210538macrunner
ParticipantNow I understand my mistake, I used:
$output .=
But I should have used it:
$meta =
as indicated in your tutorial.
Now it works fine, thank you very much.August 19, 2017 at 3:06 am #210539macrunner
ParticipantI have noticed now, the only problem, appears twice the title, once in the header and once in the content
-
AuthorPosts
- The topic ‘In Showcase Pro – move entry info after the title’ is closed to new replies.