Sign in to follow this  
Followers 0

Display Custom Fields in Sidebar

11 posts in this topic

Posted · Report post

I'm trying to display two custom text fields (website_name and website_rating) in the Primary Sidebar and have failed to do so. If the post is in the Websites category, I want the widget displaying the data to be activated. What is the most direct way of accomplishing this? I have tried searching in the forum/all of over the internet and have failed to come up with a working solution.

Share this post


Link to post
Share on other sites

Posted · Report post

The only way would be to make changes in the code, which requires that you use the Base theme in PageLines Framework. I've been searching around, as well, but couldn't find a solution. Have you tried searching for a plugin that would allow you to do this?: http://wordpress.org/extend/plugins/

Share this post


Link to post
Share on other sites

Posted · Report post

Thank you so much for the prompt response Catrina. Any idea on how I could modify the Base theme to do this? I have looked up how to do this but all the possible solutions I have found conflict with the Pagelines Framework.

Share this post


Link to post
Share on other sites

Posted · Report post

Hi, The issue you're facing is really not theme related in any way, but WordPress. We don't create the widgets. But, that said, you can. You may also use something like Shortcode Exec PHP to create a shortcode and use a standard text widget to apply it. Creating a custom widget is something you'd learn about at www.wordpress.org.

Share this post


Link to post
Share on other sites

Posted · Report post

all of the solutions I have come across ask me to add code to functions.php and the last time I did this my website crashed

Share this post


Link to post
Share on other sites

Posted · Report post

Depending on where the code is placed in functions.php, the site may crash. Also, there may be something wrong with the code itself.

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks again for the prompt response Catrina. Rangelone.. this has something to do with pagelines because if I weren't using pagelines this would be a very simple addition. Replace: With: ID, "sidebar", true); get_sidebar($sidebar); ?> Pagelines builds the sidebar differently than a normal Wordpress set up and I can't figure out how to do it or find any documentation relating to it. I should be able to add that one line of code in somewhere I just can't figure out where. Also, if I can't figure out how to do this through Pagelines then I would like to figure out how to disable Pagelines' control of sidebars. Any ideas?

Share this post


Link to post
Share on other sites

Posted · Report post

Maybe I could create a second sidebar.php file called sidebar2.php and somehow have that sidebar2.php called on the pages I need it to be called on?

Share this post


Link to post
Share on other sites

Posted · Report post

Hi, Have you tried this plug-in ? http://wordpress.org/extend/plugins/custom-field-widget/ I have no experience with the plug-in itself but from the description, it may be what you're looking for.

Share this post


Link to post
Share on other sites

Posted · Report post

This code in functions.php works for me: [code]add_action('pagelines_inside_top_sb_primary', 'my_custom_sidebar'); function my_custom_sidebar(){ ?>

My custom widget:

Some text to display. queried_object) && $wp_query->queried_object->ID){ $field = get_post_meta($wp_query->queried_object->ID, 'key-of-custom-field', true); echo $field; } ?>
1 person likes this

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks for posting your solution, @jbrouwer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0