WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Featured Image
[resolved] Is there a way to obtain url of featured image url (7 posts)

  1. clestcruz
    Member
    Posted 7 months ago #

    Basically i'm trying to develop a post with a fancybox option feature.

    My approach is that i will set to featured images(Featured Image 1 and Featured Image 2). Once i click on featured image 1 it will display featured image 2 on a fancybox window. Is there a way to obtain the url of featured image 2.

    http://wordpress.org/plugins/dynamic-featured-image/

  2. Ankit Pokhrel
    Member
    Plugin Author

    Posted 7 months ago #

    Hi,

    Thank you for using the plugin. Yes you can obtain the url of the second image using simple array manipulation techniques.

    echo $pluginOutputArray[0]['thumb']; //will give you selected image url of first image
    echo $pluginOutputArray[0]['full']; //will give you full value of first image
    echo $pluginOutputArray[1]['thumb']; //will give you selected image url of second image
    echo $pluginOutputArray[1]['full']; //will give you full value of second image

    Thanks,
    Ankit

  3. clestcruz
    Member
    Posted 7 months ago #

    Hello ankit, i'm having a bit of a problem in displaying the second featured image on the fancybox window. Basically whenever i click the magnify button. It just displays a text and does not display the second featured image. Here is a sample of the code

    <div class="collections_dresses_container">
    
    			    <?php query_posts('posts_per_page=-1&cat=10'); if(have_posts()) : while(have_posts()) :the_post(); ?>
    		        <div class="collections_thumbnails">
    
    				  <?php if ( has_post_thumbnail()) { $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo '<img src="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '">';  } ?>
    
    				  <div class="hover_dress">
    					<a class="fancybox" href="<?php echo $pluginOutputArray[0]['thumb'] ?>"><span><?php the_title(); ?></span></a>
    				  </div>
    		        </div>
    			    <?php endwhile; endif; wp_reset_query();?>
    
    		     </div>

    Here is a screenshot of what images i have placed using your plugin.
    [IMG]http://i255.photobucket.com/albums/hh140/testament1234/dynamicimage_zps906f53b1.jpg[/IMG]

  4. Ankit Pokhrel
    Member
    Plugin Author

    Posted 7 months ago #

    Are you able to display second featured image in your page? I mean outside fancybox, in your theme page?

  5. Ankit Pokhrel
    Member
    Plugin Author

    Posted 6 months ago #

    I am closing the issue because there is no any response from 2 weeks.

  6. rajbir4all
    Member
    Posted 5 months ago #

    Hello,

    I tried this echo $pluginOutputArray[0]['full']; but am getting blank value please suggest.

    getting this:
    <header class="headerinnerclass" style="background-image: url('')">

    Thanks

  7. Yobado
    Member
    Posted 2 weeks ago #

    Hello,

    Having a problem calling the featured image from the plugin "Dynamic Featured Image"

    I would like to be able to show featured image 2 and featured image 3 in the posts (
    How do I get the code correct so I can show featured image 2 and 3?

    Current code of single.php

    <?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
    <?php get_header(); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <article id="post-<?php the_ID(); ?>" <?php post_class("entry clearfix"); ?>>

    <?php
    $post_pod_type = get_post_meta($post->ID, 'post_pod_type', true);
    $post_type_values = get_post_meta($post->ID, 'post_type_values', true);
    //***
    switch ($post_pod_type) {
    case 'audio':
    echo do_shortcode('[tmm_audio]' . $post_type_values[$post_pod_type] . '[/tmm_audio]');
    break;
    case 'video':
    ?>

    <?php
    $video_width = 700;
    $video_height = 300;

    $source_url = $post_type_values[$post_pod_type];
    if (!empty($source_url)) {

    $video_type = 'youtube.com';
    $allows_array = array('youtube.com', 'vimeo.com');

    foreach ($allows_array as $key => $needle) {
    $count = strpos($source_url, $needle);
    if ($count !== FALSE) {
    $video_type = $allows_array[$key];
    }
    }

    switch ($video_type) {
    case $allows_array[0]:
    echo do_shortcode('[tmm_video type="youtube" width="' . $video_width . '" height="' . $video_height . '"]' . $source_url . '[/tmm_video]');
    break;
    case $allows_array[1]:
    echo do_shortcode('[tmm_video type="vimeo" width="' . $video_width . '" height="' . $video_height . '"]' . $source_url . '[/tmm_video]');
    break;
    default:
    break;
    }
    }
    ?>

    <?php
    break;

    case 'quote':
    echo do_shortcode('[blockquote]' . $post_type_values[$post_pod_type] . '[/blockquote]');
    break;

    case 'gallery':
    TMM_OptionsHelper::enqueue_script('cycle');
    $gall = $post_type_values[$post_pod_type];
    ?>

    <?php if (!empty($gall)) : ?>

    <div class="image-post-slider">

    </div><!--/ .image-post-slider-->

    <?php endif; ?>
    <?php
    break;

    default:
    ?>
    <?php if (has_post_thumbnail()) : ?>

    <div class="entry-thumb">
    <div class="preloader">ID, ''); ?>"><img src="<?php echo TMM_Helper::get_post_featured_image($post->ID, '700*300'); ?>" alt="<?php the_title(); ?>" /></div>
    </div>

    <?php endif; ?>
    <?php
    break;
    }
    ?>

    <div class="entry-title">
    <h2 class="title"><?php the_title(); ?></h2>
    </div><!--/ .entry-title-->

    <?php if (TMM::get_option("blog_single_show_all_metadata")) : ?>

    <div class="entry-meta">

    <?php if (TMM::get_option("blog_single_show_date")) : ?>
    <span class="date">/<?php echo get_the_date('Y/m') ?>"><?php echo get_the_date() ?></span>
    <?php endif; ?>

    <?php if (TMM::get_option("blog_single_show_author")) : ?>
    <span class="author"><?php _e('By', TMM_THEME_FOLDER_NAME); ?> <?php the_author_link() ?></span>
    <?php endif; ?>

    <?php $tags = get_the_tag_list('', ', '); ?>
    <?php if (TMM::get_option("blog_single_show_tags") AND !empty($tags)) : ?>
    <span class="tag"><?php echo $tags ?></span>
    <?php endif; ?>

    <?php if (TMM::get_option("blog_single_show_category")) : ?>
    <?php $categories_list = get_the_category_list(__(', ', TMM_THEME_FOLDER_NAME)); ?>
    <?php if (!empty($categories_list)) : ?>
    <span class="categories">
    <?php _e('In', TMM_THEME_FOLDER_NAME); ?>
    <?php echo $categories_list ?>
    </span>
    <?php endif; ?>
    <?php endif; ?>

    <?php if (TMM::get_option("blog_single_show_comments")) : ?>
    <span class="comments">#comments"><?php echo get_comments_number(); ?> <?php _e('Comments', TMM_THEME_FOLDER_NAME); ?></span>
    <?php endif; ?>

    </div><!--/ .entry-meta-->

    <?php endif; ?>

    <div class="entry-body">

    <?php the_content() ?>
    <?php TMM_Ext_LayoutConstructor::draw_front($post->ID); ?>

    <?php if (TMM::get_option("blog_single_show_bio")): ?>
    <?php $user = get_userdata($post->post_author); ?>
    <?php if (is_object($user)): ?>
    <div class="author-about">

    <div class="author-thumb">

    <div class="avatar">
    <?php
    $avatar_url = get_avatar($user->user_email, 60);
    echo $avatar_url;
    ?>
    </div>

    </div><!--/ .author-thumb-->

    <div class="author-entry">

    <h5><?php _e('About the Author', TMM_THEME_FOLDER_NAME); ?></h5>
    <p><?php echo stripslashes($user->description); ?></p>

    </div><!--/ .author-entry-->

    </div><!--/ .about-author-->
    <?php endif; ?>
    </div><!--/ .entry-body-->

    <?php endif; ?>

    </article><!--/ .entry-->

    <?php if (TMM::get_option("blog_single_show_comments")): ?>

    <?php comments_template(); ?>

    <?php endif; ?>

    <?php
    endwhile;
    endif;
    ?>

Reply

You must log in to post.

About this Plugin

About this Topic

Tags