• Documentation
  • Support / Community
  • Products
    • Piklist Framework
    • Toolbox
    • Fields and Forms
    • WordPress Helpers
  • Log In
Piklist

Access your account, and post on the Support Forums

Retrieve Password | Register for account

Topic: [Resolved]Basic front end help

Support Home » Topics » Piklist » Basic front end help

Tagged: display, Front End, get_post_meta, single.php, theme

  • This topic has 6 replies, 3 voices, and was last updated 6 years, 2 months ago by Steve.
Viewing 6 reply threads
  • Author
    Posts
    • March 22, 2014 at 5:19 am #1593
      nadia
      Member

      Hi there,

      I’m really stuck. I just can’t seem to get my Piklist editor values to show in replace of the default WordPress values. Have looked through the forums which point me to the get_post_meta in WordPress help, but it’s just not helping.

      I have created my demo_metabox.php file.
      And within it have created a text field:
      piklist(‘field’, array(
      ‘type’ => ‘text’
      ,’field’ => ‘subtitle’
      ,’label’ => ‘Subtitle Text Box’
      ,’description’ => ‘Enter the year of birth here’
      ,’value’ => ‘Default text’
      ,’help’ => ‘Example: b.1940′
      ,’attributes’ => array(
      ‘class’ => ‘text’
      )
      ));
      This is working, it now shows in the editor.
      Great. Happy with this.

      In single.php I have called my custom fields in the same way I would normally.

      <?php
      $subtitle= get_post_meta($post->ID, ‘demo_subtitle’, true);
      ?>

      <?php if($subtitle){?>
      <h3><?php echo $subtitle;?></h3>
      <?php } ?>

      This returns nothing.
      I just can’t move forward until I figure out how to get the values coming through.

      Please help!
      Cheers.

    • March 22, 2014 at 12:21 pm #1594
      Steve
      Keymaster

      Your field is subtitle but you’re pulling demo_subtitle. They need to match.

    • November 28, 2015 at 6:46 pm #5145
      Anthony
      Member

      I think this thread is addressing a similar (basic problem) for me. I have a custom post type that I am using Piklist to relate to my regular posts. If the regular post has the related post checked off then it should display the singular template in a certain way otherwise it reverts to its default.

      <?php while (have_posts()) : the_post(); ?>
      	
      	
      	<?php $purchase = get_post_meta(get_the_ID(), 'sponsor', true ); var_dump( $purchase );   ?>
      	<?php if( ! $purchase ) { ?>
      		
      		
      		<div class="inner">
      		<ul class="author-post actions">		
      		<li><a class="icon-wrapper circle" 
      			href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
      		<?php echo get_avatar( get_the_author_meta( 'ID' ), 48 ); ?>
      		</a></li>
      		<li><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
      		<?php echo get_the_author();?></a>
      		<br /><?php posted_on(); ?></li>
      		<li><li><a href="<?php the_permalink();?>" class="button">Purchase</a></li></li>
      		</ul>
      		</div><!-- inner //-->
      		

      The issue is that the var_dump reveals: string(0) ""

      It’s simply not getting any results, therefore my template is always displaying the “false” conditional.

    • November 28, 2015 at 10:55 pm #5149
      Steve
      Keymaster

      Can you post the field code for ‘sponsor’?

    • November 28, 2015 at 11:34 pm #5151
      Anthony
      Member

      I RTFM the related posts section of the documentation and found that it was better to use get_posts() instead of get_post_meta():

      ?php if (have_posts()) : ?>
      	<section id="main" class="wrapper style3">
      	<?php while (have_posts()) : the_post(); ?>
      	
      	
      	<?php 
      		$purchasers = get_posts(array(
      		'post_type' => 'sponsor'
      		,'posts_per_page' => -1
      		,'post_belongs' => $post->ID
      		,'post_status' => 'publish'
      		,'suppress_filters' => false // This must be set to false
      		));
      		
      		 var_dump($purchasers); // do we have a pulse? 

      I keep getting no results. Sorry about posting in the other thread. I thought it was cross related. No issue-pun intended.

    • November 29, 2015 at 11:04 am #5154
      Anthony
      Member

      Never mind I figured it out. The code was correct.

    • November 30, 2015 at 4:26 pm #5162
      Steve
      Keymaster

      Great. Closing ticket.

  • Author
    Posts
Viewing 6 reply threads
  • The topic ‘Basic front end help’ is closed to new replies.

Log in / Register

Register for an Account

Stay up-to-date with Piklist

About

  • Philosophy
  • Privacy Policy
  • Terms of Service
  • Contact Us
  • Register for an account

Resources

  • Community Forums
  • Documentation
  • Tutorials
  • Get involved

Follow Piklist

  • Like us on Facebook
  • Follow us on Twitter
  • Connect on Google +
  • Watch on YouTube

Rate Piklist


If you love Piklist leave us a 5 Star review on WordPress.org.

News

  • Piklist v0.9.9.8 is now available

    September 30, 2019

    In October of 2015, we released v0.9.9 of Piklist. Your help in testing lead to seven(7) m ...

  • Piklist is now on HackerOne

    September 30, 2019

    We built Piklist from the ground up with security as our top priority. While we’ve t ...

  • Read all News
  • Powered by Piklist & WordPress © 2009 – 2022 Piklist LLC.
    This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to the use of cookies. Find out more.