• Resolved AdamSch

    (@adamsch)


    Well I have tried multiple different things and I am having trouble getting this figured out and need some help. Website is spectaclip.com.

    I am trying to insert the text from “bottom” on the custom field template into the bottom of the buy button on the webpage. I think I have it setup right but I am not able to get it to show up.

    Here is what I have –

    In Custom field template:

    [bottom]
    type = text
    size = 35

    In PHP:

    <?php get_header(); ?>
    <div id="wrapper"<?php if (is_front_page()): ?> class="home"<?php endif; ?>>
    <?php slideshow_loop(1, 'home_slideshow.php'); ?>
    <div id="hp-content">
      <div class="inner">
        <div id="video">
          <p class="video-title"><?php echo get_post_meta($post->ID, 'video title', true); ?></p>
    	  <p class="hp-para"><?php echo get_post_meta($post->ID, 'paragraph', true); ?></p>
    	  <?php
    		if (have_posts()): while (have_posts()): the_post();
    		$content = get_post_meta($post->ID, 'video shortcode', true);
    		$content = apply_filters('the_content', $content);
    		$content = str_replace(']]>', ']]>', $content);
    		_e($content);
    		endwhile; endif; wp_reset_query();
    	  ?>
    		<a href="<?php bloginfo('url'); ?>/shop/spectaclip/"><p class="buy-now"><?php echo get_post_meta($post->ID, 'buy button text', true); ?></p></a>
    	<p class="bottom"><?php echo get_post_meta($post->ID, 'bottom', true); ?></p>
        </div>
      </div>
      <?php slideshow_loop(1, 'home_slideshow.php'); ?>
      <div class="cf"></div>
    </div>
    </div>
    <?php get_footer(); ?>

    In CSS:

    p.bottom {
        	font-size: 16px;
    	font-weight: 600;
    	line-height: 18px;
    	padding: 5px 20px;
    	text-align: center;

    Thanks for help in advance!

    Adam

Viewing 15 replies - 1 through 15 (of 24 total)
  • You’re calling it outside of a loop that’s been reset. The first parameter of get_post_meta is $post_id. In the above code, that would refer to the `global $post’ variable. I’d venture to guess that’s not what you want.

    Depending on which post you’ve associated the meta value to, that’s the post ID you want to assign as the first parameter.

    Thread Starter AdamSch

    (@adamsch)

    Hi Christian1012,

    Thank you for your fast response. Would you mind giving me an example of what I need? I am pretty unfamiliar with PHP.

    I think I understand what you are saying. However, the ‘video title’ and ‘paragraph’ are both pulling in?

    Thanks for your help.

    Adam

    Did you set the values for buy button text and bottom on the same page?

    Thread Starter AdamSch

    (@adamsch)

    Yes they are. All of the custom fields are showing on the page-home.php template and are editable in the home page “page”.

    Thread Starter AdamSch

    (@adamsch)

    Here is the way it is pulling into the actual page. I can see the “bottom” pulling in, but not actually showing??

    From Firebug:

    <div id="video">
          <p class="video-title">- Respect Your Specs -</p>
    	  <p class="hp-para">Find your Sight - peace of mind knowing where your eyeglasses are and that they are secure.&nbsp;<a title="Demonstration" href="http://spectaclip.com/demonstration/">LEARN MORE!</a></p>
    	  <span class="embed-youtube" style="text-align:center; display: block;"><iframe class="youtube-player" type="text/html" src="https://www.youtube.com/embed/0PFvN6MSXds?version=3&rel=0&fs=1&showsearch=0&showinfo=0&iv_load_policy=1&wmode=transparent" frameborder="0" height="218" width="383"></iframe></span>
    		<a href="https://www.spectaclip.com/shop/spectaclip/"><p class="buy-now">$9.95 or Buy 2 Get 1 FREE!</p></a>
    		<p class="bottom"></p>
        </div>

    Comment out the line in question

    <?php // echo get_post_meta($post->ID, 'bottom', true); ?>

    and under it add:

    <?php
       $bottomText = get_post_meta( $post->ID );
       var_export( $bottomText );
    ?>

    That will dump the value of $bottomText, which will be an associative array of keys and values. See if the key ‘bottom’ is set to the value you want it to, or if it exists in the array.

    Thread Starter AdamSch

    (@adamsch)

    Here is what I got. It showed up under the video. I don’t understand it. Sorry. It looks as if it is showing though. I appreciate your help!

    array ( '_edit_lock' => array ( 0 => '1378978369:13', ), '_edit_last' => array ( 0 => '13', ), '_wp_page_template' => array ( 0 => 'default', ), 'video title' => array ( 0 => '- Respect Your Specs -', ), 'video shortcode' => array ( 0 => '[youtube=http://www.youtube.com/watch?v=0PFvN6MSXds&rel=0&w=383&&h=218&showinfo=0&autohide=1]', ), '_plusvideocache' => array ( 0 => 'a:1:{s:7:"youtube";a:3:{s:11:"j6PrVq015NM";a:10:{s:9:"available";b:1;s:8:"provider";s:7:"YouTube";s:9:"mediatype";s:6:"iframe";s:5:"title";s:32:"Board Insights with Mylle Mangum";s:8:"embedurl";s:60:"http://www.youtube.com/embed/j6PrVq015NM?autoplay=1&hd=1";s:9:"thumbnail";s:40:"https://i1.ytimg.com/vi/j6PrVq015NM/0.jpg";s:5:"width";i:480;s:6:"height";i:360;s:4:"link";s:42:"http://www.youtube.com/watch?v=j6PrVq015NM";s:9:"timestamp";i:1372851576;}s:11:"Ai6QhdR8hBg";a:10:{s:9:"available";b:1;s:8:"provider";s:7:"YouTube";s:9:"mediatype";s:6:"iframe";s:5:"title";s:10:"SpectaClip";s:8:"embedurl";s:60:"http://www.youtube.com/embed/Ai6QhdR8hBg?autoplay=1&hd=1";s:9:"thumbnail";s:40:"https://i1.ytimg.com/vi/Ai6QhdR8hBg/0.jpg";s:5:"width";i:480;s:6:"height";i:360;s:4:"link";s:42:"http://www.youtube.com/watch?v=Ai6QhdR8hBg";s:9:"timestamp";i:1375837809;}s:11:"0PFvN6MSXds";a:10:{s:9:"available";b:1;s:8:"provider";s:7:"YouTube";s:9:"mediatype";s:6:"iframe";s:5:"title";s:66:"SpectaClip with Bob Circosta on "What a Great Idea!" - Quick Clip!";s:8:"embedurl";s:60:"http://www.youtube.com/embed/0PFvN6MSXds?autoplay=1&hd=1";s:9:"thumbnail";s:40:"https://i1.ytimg.com/vi/0PFvN6MSXds/0.jpg";s:5:"width";i:480;s:6:"height";i:360;s:4:"link";s:42:"http://www.youtube.com/watch?v=0PFvN6MSXds";s:9:"timestamp";i:1379523372;}}}', ), 'buy button text' => array ( 0 => '$9.95 or Buy 2 Get 1 FREE!', ), 'paragraph' => array ( 0 => 'Find your Sight - peace of mind knowing where your eyeglasses are and that they are secure. LEARN MORE!', ), 'Bottom' => array ( 0 => 'Save TIME, MONEY and FRUSTRATION!', ), )
    Thread Starter AdamSch

    (@adamsch)

    Got it. Capitalize the “B”. Now if I can just get the CSS to format it I will be good to go! Thank you!

    Thread Starter AdamSch

    (@adamsch)

    But…I still am having the same problem I have had with this. For some reason I cannot change things via CSS on this page. I have tried .Bottom, #Bottom, p.Bottom, and nothing changes anything. It is very weird though. When I look at the page in Firebug, it does not show any of the CSS changes…but it is applying them to the other classes.

    Do I have something wrong?? This is what I currently have.

    Thank you!

    p.Bottom {
        	font-size: 16px;
    	font-weight: 600;
    	line-height: 18px;
    	padding: 5px 20px;
    	text-align: center;
    }
    p.bottom{
     styles
    }

    The class is still lowercase.

    Thread Starter AdamSch

    (@adamsch)

    Didn’t work…

    <p class="bottom"><?php echo get_post_meta($post->ID, 'bottom', true); ?></p>

    This is the line you’re trying to style correct? Can you link me to the site so I can see?

    Thread Starter AdamSch

    (@adamsch)

    Yes that is it. What do you mean by link? You need access to admin?? It is spectaclip.com if that is what you are looking for.

    Thank you.
    Adam

    No no, I don’t need admin. Never give anyone on the forums admin.

    I’m using

    .Bottom{
     /*Styles*/
    }

    in chrome developer tools and it’s working just fine. I may be late with this though.

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Line Not Pulling In With Custom Field Template’ is closed to new replies.