Community Forums › Forums › Archived Forums › Design Tips and Tricks › Customize entry content
Tagged: Custom fields
- This topic has 8 replies, 2 voices, and was last updated 11 years, 2 months ago by sheilab.
-
AuthorPosts
-
January 15, 2013 at 5:45 pm #12154sheilabParticipant
I have a client who would like a paragraph to the right of a slideshow for each of her posts.
Can you point me in a direction as to how I could do this? The slideshow can be implemented with short code or as a widget. I could have her set up a different simple sidebar for each post but she is not that savvy and as the site grows, that would be lots of sidebars.
Using Outreach 2 theme.
January 15, 2013 at 6:38 pm #12166SoZoMemberAre the paragraphs going to be unique to each post? If so I would pull the text from a custom field. Or if you are using a slideshow with shortcode then you could add the text right after the shortcode and float it.
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 15, 2013 at 7:33 pm #12178sheilabParticipantThanks! Custom fields and CSS should work for me here. I have put this code into my functions.php file but am getting a syntax error and I just can't see it. Please advise.
/* add custom fields smb*/
if( genesis_get_custom_field( 'slideshow_shortcode' )
echo '<div class="slideshow_shortcode">' . genesis_get_custom_field( 'slideshow_shortcode' ) .'</div>';if( genesis_get_custom_field( 'project_description' )
echo '<div class="project_description">' . genesis_get_custom_field( 'project_description' ) .'</div>';January 15, 2013 at 7:34 pm #12179sheilabParticipantWhen I submit a reply to this post, I am sent to a 404 page.
January 16, 2013 at 12:11 pm #12350SoZoMemberWhat is the syntax error and what else are you putting in functions.php?
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 16, 2013 at 7:23 pm #12502sheilabParticipantI found the syntax error, I was missing the end parenthesis in my functions. I'm seeing the custom fields now but I still need help getting the slideshow short code to read as short code. http://www.teripower.dev/project-2/
This is the code in my functions.php file:
/** Add custom fields to project category posts smb*/
add_action( 'genesis_post_content', 'child_custom_field' );
function child_custom_field() {
if( genesis_get_custom_field( 'slideshow_shortcode' ))
echo '<div class="slideshow_shortcode">' . genesis_get_custom_field( 'slideshow_shortcode' ) .'</div>';
if( genesis_get_custom_field( 'project_description' ))
echo '<div class="project_descriptione">' . genesis_get_custom_field( 'project_description' ) .'</div>';
}I've played with adding parts of the code below to the code above and also tried wrapping parts of it around the short code's custom field value when I define it in the post editor but can't get it right. The short code calls a slideshow. Should I post this as a new topic?
echo do_shortcode("[Shortcode]");
I'm getting closer.
Thanks!
Sheila
January 17, 2013 at 12:20 pm #12664SoZoMemberIf you want to enter the shortcode into the custom field then you need to edit echo do_shortcode(“[Shortcode]“); and replace "Shortcode" with the custom field output. i.e. echo do_shortcode(“[. genesis_get_custom_field( ‘slideshow_shortcode’ ) .]“);
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 17, 2013 at 2:36 pm #12717sheilabParticipantI have added the do_shortcode function to the echo command and have tried for hours to get rid of this parse error:
Parse error: syntax error, unexpected '[' in /Users/bergman/Documents/Websites/www.teripower.dev/wp-content/themes/outreach/functions.php on line 81 (line 81 is the echo do_shortcode line for the slideshow_shortcode.)
Please take a look and see what I'm doing wrong. Thanks.
/** Add custom fields to project category posts smb*/
add_action( ‘genesis_post_content’, ‘child_custom_field’ );
function child_custom_field() {if( genesis_get_custom_field( ‘slideshow_shortcode’ ))
echo do_shortcode(“[. genesis_get_custom_field( ‘slideshow_shortcode’ ) .]“);if( genesis_get_custom_field( ‘project_description’ ))
echo ‘<div class=”project_descriptione”>’ . genesis_get_custom_field( ‘project_description’ ) .’</div>’;
}January 24, 2013 at 4:51 pm #14438sheilabParticipantThis is the final working version of the code that worked for me:
/** Add custom fields to project category posts smb. This works.*/
add_action( 'genesis_post_content', 'child_custom_field' );
function child_custom_field() {
if( genesis_get_custom_field( 'project_description' ))
echo '<span class="project_description">',
genesis_get_custom_field( project_description ) ,'</span>';
if( genesis_get_custom_field( 'slideshow_shortcode' ))
echo '<span class="slideshow_shortcode">', do_shortcode(''. genesis_get_custom_field( 'slideshow_shortcode' ) .''),'</span>';
} -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.