Jump to content

Archived

This topic is now archived and is closed to further replies.

circ2013

Using Custom Fields and pl-nextbox or some other method to display them?

Recommended Posts

circ2013

Hello Pagelines, I have spent the better part of the day trying to figure out how to set up custom fields within posts where the values can then be displayed on the front end within a PL-nextbox section.

 

Here is what I am trying to do with no luck thus far.

 

I have set up custom fields within posts.  For example, I am doing a site for builder.  We want custom fields within each post for Architect, Landscape architect, Interior Designer, Testimonial, Sustainability Features, Date Completed, and Location.  I have set it up so that each label is the key and what ever the client enters is the value.

 

I would them like to display these fields on the post either within the_content of the post/loop or outside of the content in a PL-Nextbox.

 

I have tried using the following within the pl-nextbox, but it keeps returning "Looks like your NextBox PHP resulted in an error :/"

<?php $post->ID = 1446;?>

<?php echo esc_html(get_post_meta($post->ID, 'project_type', true));?>
<?php echo esc_html(get_post_meta($post->ID, 'architect', true));?>
 
Anyone have any suggestions on how I can pull this off?  Should I add this directly to the sections.php file with DMS>Sections>Postloop>sections.php?
 
I was hoping to create a left column that would display all the project details in an unordered list with some additional formatting...  Then have the project description (wp_Content/loop) display to the right in a new column, but if I have to create a special template and include my updates within the file, I can give that a shot.
 
Thanks,
Scott

 

 

Share this post


Link to post
Share on other sites
Simon

Yes that will be an error...

$post is not set, so $post->ID will be undefined...

Also you have multiple open/close php tags...
 

global $post;
echo esc_html(get_post_meta($post->ID, 'project_type', true));
echo esc_html(get_post_meta($post->ID, 'architect', true));

Share this post


Link to post
Share on other sites
circ2013

Thank you for the help here.  I guess following the tutorial I was using to a "t" was the issue.

 

Thanks again.

 

Scott

Share this post


Link to post
Share on other sites

  • Similar Content

    • werdnags
      By werdnags+
      Can anyone guide me please?
      I would like to learn how to achieve custom fields and going to give ACF plugin a try.  I have watched all the videos and read the documentation and all is good except I can find the template files for the pages and posts.  I believe I should be looking for the file single.php but what about posts?  Is the reason I can't find them because I am using a framework? Pagelines Framework?  How can I add my custom fields to the templates on Pagelines Framework?
      Any guidance would be appreciated please.
    • flourishdesignstudio
      By flourishdesignstudio+
      Hi,
      I am using PL5 as well as Advanced Custom Fields (AFC) to help add meta data to individual posts on our blog. However, where I am getting stuck is how to display the meta data on the actual public post page (frontend). For example, if we have posts that have a subject matter of plants then there are custom fields that the client fills out such as "Scientific Name", "Region", etc. I have used ACF before to display this meta data onto the loops section as well as in Revolution Slider or Essential Grid. However, I am not sure if there is a way to have this metadata display on the actual post page. Can you point me in the right direction? I am using a child theme so I wasn't sure if that meant I had to edit the functions.php file or if there was some other workaround that you knew of.
      Thanks so much!
    • PeriniNero
      By PeriniNero+
      We are building a Custom Post Type with Custom Fields and Custom Taxonomies.
      The only thing we dont understand is how to embed the Custom Fields including header tags and stuff in the Postloop (now we use a text-box below the postloop section but also SEO wise this is not best pratice).
      So we thought to copy the dms Postloop section to our child theme and rename this, to add an extra Postloop section to our theme. Is this the way?
      What exactly to adjust in those 3 files class.posts.php, section.php and style.less (at this point we know how to change the thumb LOL) and where to add the Custom Fields shortcodes?
      Thanks.
    • Lisa Haran
      By Lisa Haran+
      Hi 
      I have a map here http://www.iloveoffset.com/maps/
      I want to add several pointer locations to the map, but when I do they do not appear.
      On this map there are 2 pointer locations and as you can there is only one visible.
      Earlier today I added 7 and could only see 4 so there is something odd going on.
      My theme is up to date
    • clj182
      By clj182+
      Hello,
      I've been having trouble unlocking the template section for past couple of weeks. When I try clicking nothing happens. 
      I've deleted my custom css and removed plugins. Im down to having only the following plugins:
      Akismet
      Contact Form 7
      DMS Professional Tools
      Pagelines Updater
      WooCommerce
      It was working fine before i have no idea what's going on with it.
×