Community Forums › Forums › Archived Forums › General Discussion › Alternative option on genesis_entry_footer Simple Hook
Tagged: Entry Footer, entry-meta, is_front_page, shortcode
- This topic has 8 replies, 3 voices, and was last updated 8 years, 6 months ago by riseUp.
-
AuthorPosts
-
July 20, 2016 at 8:17 pm #189875riseUpMember
Hello community,
I will do my best to explain the situation on the struggle that I'm experiencing.
My website is http://www.ymphony.com. When you go to the homepage, you will notice multiple posts by different users. You will see a Title and Description. Underneath the Description, notice the horizontal line and Location field.
I have been attempting to add short code, [frm-field-value field_id=145 user_id="[q38d7 show=ID]"] into the genesis_entry_footer simple hook as the horizontal line and Location label is on the genesis_entry_footer hook. When I add the above shortcode into this hook, it does not work since it seems as though the simple hook page does not recognize this kind of shortcode.
However, when I placed the short code on the body of the page, it worked - it showed the City of the post submitter. Basically, the short code works fine...it's just that the short code does not work on the simple hook.
Question: is there a piece of recommended code that I can use to add onto the function.php page to allow the short code to be placed on the body of the page to avoid using the genesis_entry_footer simple hook? If I am able to place the short code onto the body of the page and have the output of the short code to display on the homepage (for each post), this would help me.
Please advise? Thank you.
http://www.ymphony.comJuly 21, 2016 at 1:59 am #189886Brad DaltonParticipant1. You can use the is_front_page() conditional tag with a genesis hook in a custom function. The genesis_entry_footer hook is ideal.
or
2. Add the shortcode to the entry footer entry meta filter adding the is_front_page conditional tag.
July 21, 2016 at 5:31 am #189896riseUpMemberHi @BradDalton, thank you for your response.
I was looking at option 2....how does this look?
//* Customize the entry meta in the entry footer (requires HTML5 theme support)
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
function sp_post_meta_filter($post_meta) {
$post_meta = '[post_categories] [post_tags]';
return $post_meta;if ( is_front_page() ) {
echo do_shortcode('[frm-field-value field_id=145 user_id="[q38d7 show=ID]"]');
}
}Do I put this piece of code within the genesis_entry_footer hook area or place this in functions.php? I tried both but the horizontal line and Location: field is not displaying on each post (bottom of post) on the homepage. Thank you.
Moses
July 21, 2016 at 10:47 am #189885Brad DaltonParticipant1. You can use the is_front_page() conditional tag with a genesis hook in a custom function. The genesis_entry_footer hook is ideal.
or
2. Add the shortcode to the entry footer entry meta filter adding the is_front_page conditional tag.
July 21, 2016 at 11:26 am #189933Genesis DeveloperMemberTry it:
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' ); function sp_post_meta_filter($post_meta) { $post_meta = '[post_categories] [post_tags]'; if ( is_front_page() ) { $post_meta .= '[frm-field-value field_id=145 user_id="[q38d7 show=ID]"]'; } return $post_meta; }
July 21, 2016 at 4:47 pm #189970riseUpMemberHi Genesis Developer,
When I copied and pasted your code to my functions.php, it didn't work. The horizontal line and location field did not display on the homepage for each post. Any other thoughts? Thank you.
July 21, 2016 at 9:18 pm #189984Genesis DeveloperMemberReplace
if ( is_front_page() ) {
WITH
if ( is_home() ) {
And test once.
July 21, 2016 at 9:23 pm #189985riseUpMemberHello everybody.
Here is the latest. I added the following shortcode into the genesis_entry_footer hook....and the City was able to be displayed at the bottom of each post on the homepage. However, user [email protected] indicated Albia as the city but the homepage post for [email protected] lists Beaverton. It looks as if the following code in the genesis_entry_footer hook displays mike smith23's city selection.
<?php if( is_front_page() ) { ?>
[frm-field-value field_id= 145 user_id="[95 show=ID]
<?php } ?>Can somebody advise on how I can tweak the above php code to ensure that the city that a user selects displays that city for his/her post and not to be included in another user's post? Thank you.
July 21, 2016 at 10:08 pm #189988riseUpMemberAll,
The City displayed for joyeagles7890 is Albia. Albia is showing correctly at the bottom of the post. The issue I'm still having is that Albia is not showing on the homepage for the post.
Mike Smith 23 is Beaverton which is right on the bottom of the post. However, the issue I'm having is that Beaverton is not showing on the homepage for the post.
I have tried this:
<?php if( is_home() ) { ?>
[frm-field-value field_id= 145 user_id="[95 show=ID]
<?php } ?>But I may need a tweak to allow the City result to be displayed on the homepage.
Thank you for your assistance.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.