This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Image Caption/Description Text in Custom content-grid

  • Creator
    Topic
  • #8260
    Ron
    Participant

    Using Jumpstart (current), I am developing a couple of custom content-grid.php files to configure grid layouts based on categories. (got that working easily, thanks to the way you code works!)

    Are there TB functions/attributes to get the image/thumbnail Captions and/or Descriptions for display that I can use in the content-grid.php files?
    something like themeblvd_get_att( ‘xxxxxxx’)?

    Also, to get the URL to the image for light box? My client wants the Post Title link to go to a post (works ok) but the Image to be linked to go to Lightbox.

    (it may be late and so I’m missing something.)

    (My client really wants this to work easily with posts and categories, since she doesn’t get galleries and doesn’t want to mess with them. It would be best if the Caption and Description be kept with the image too.)

    Thanks,
    Ron

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #8265
    Jason Bobich
    Keymaster

    Hello Ron,

    Here are just some basic WP functions that’ll hopefully help.

    1) This would display the featured image without any link around it that you could then wrap:

    <?php the_post_thumbnail(); ?>

    http://codex.wordpress.org/Function_Reference/the_post_thumbnail

    Or to retrieve it for a variable.

    <?php $image = get_the_post_thumbnail(); ?>

    http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

    2) In order to get a caption, title, etc, from the actual attachment that is the featured ID, you’d need to get the post object for it.

    <?php 
    $image = get_post( get_post_thumbnail_id() );
    
    // Now take a look at what's in your post object...
    print_r($image);
    ?>

    http://codex.wordpress.org/Function_Reference/get_post_thumbnail_id

    http://codex.wordpress.org/Function_Reference/get_post

    3) And then the link URL to the lightbox is just saved as standard meta data to the post under the key _tb_external_link.

    <?php $link = get_post_meta( get_the_ID(), '_tb_external_link', true ); ?>

    http://codex.wordpress.org/Function_Reference/get_the_ID

    http://codex.wordpress.org/Function_Reference/get_post_meta

    #8299
    Ron
    Participant

    Thanks, Jason.

    I mostly got it working.

    Still have some difficulty getting the lightbox to come up.

    The

    "<?php $link = get_post_meta( get_the_ID(), '_tb_external_link', true ); ?>"

    code didn’t seem to produce any URL.

    Also when I use the rel=”themeblvd_lightbox” tag it doesn’t come up in a lightbox (using a different URL):

    "<a href="<?php print_r(get_post( get_post_thumbnail_id() )->guid); ?>" rel=”themeblvd_lightbox” "><?php themeblvd_the_post_thumbnail( themeblvd_get_att( 'location' ), themeblvd_get_att( 'crop' ) ); ?>  </a>"

    WIll look at this more.

    Ron

    #8302
    Jason Bobich
    Keymaster

    This is becoming a little confusing for me. I can see that the code you’re posting doesn’t quite make sense, but it’s difficult to tell you what’s right or wrong out of context of what you’re actually doing.

    It sounds like a lot of this is coming from some basic misunderstandings of how PHP and HTML work in general. Can you link me to the entire PHP file you’re editing in its entirety so I can see what you’re actually doing in context? And a link to what it looks like on the frontend of your site?

    You can provide the code by pasting in a pasti and linking to it: http://pastie.org/?lang=php

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.