• Resolved Rico

    (@nascas)


    Hello,

    Unfortunately I can’t get this plugin to work.

    I added two extra featured images and I also added this piece of code in the single.php (at th end):

    if( class_exists(‘Dynamic_Featured_Image’) ) {
    global $dynamic_featured_image;
    $featured_images = $dynamic_featured_image->get_all_featured_images( 2 );
    }

    What am I doing wrong?

    Thank you!

    https://www.ads-software.com/plugins/dynamic-featured-image/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Ankit Pokhrel

    (@ankitpokhrel)

    Hi Rico,

    You forgot to display images after fetching data. Try this:

    if( class_exists('Dynamic_Featured_Image') ) {
         global $dynamic_featured_image;
         $featured_images = $dynamic_featured_image->get_featured_images( get_the_ID() );
    
        //You can now loop through the image to display them as required
        //For example
        foreach( $featured_images as $image ) {
            echo "<a href='{$image['full']}'>";
                echo "<img src='{$image['thumb']}' alt='Dynamic Featured Image' />";
            echo "</a>";
        }
     }

    More details here.

    Regards,
    Ankit

    Thread Starter Rico

    (@nascas)

    Thanks, but still nothing. :/

    My whole code looks like this:

    <?php $mh_newsdesk_options = mh_newsdesk_theme_options(); ?>
    <?php get_header(); ?>
    
    <div class="mh-section mh-group">
    	<div id="main-content" class="mh-content">
    		<?php mh_newsdesk_before_post_content(); ?>
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<?php get_template_part('content', 'single'); ?>
    			<?php mh_newsdesk_socialise(); ?>
    			<?php mh_newsdesk_postnav(); ?>
    			<?php if ($mh_newsdesk_options['author_box'] == 'enable') { ?>
    				<?php get_template_part('template', 'authorbox'); ?>
    			<?php } ?>
    			<?php if ($mh_newsdesk_options['related_content'] == 'enable') { ?>
    				<?php get_template_part('content', 'related'); ?>
    			<?php } ?>
    			<?php endwhile; ?>
    			<?php comments_template(); ?>
    		<?php endif; ?>
    	</div>
    	<?php get_sidebar(); ?>
    </div>
    <?php get_footer(); ?>
    
    if( class_exists('Dynamic_Featured_Image') ) {
         global $dynamic_featured_image;
         $featured_images = $dynamic_featured_image->get_featured_images( 2 );
    
        //You can now loop through the image to display them as required
        //For example
        foreach( $featured_images as $image ) {
            echo "<a href='{$image['full']}'>";
                echo "<img src='{$image['thumb']}' alt='Dynamic Featured Image' />";
            echo "</a>";
        }
     }

    Hello i have just use flexilsider js and got working see below code:

    <script>
    jQuery(document).ready(function() {
      jQuery('#flexslider').flexslider({
        animation: "fade",	slideshowSpeed: 7000,
    	animationSpeed: 600,
    	randomize: false,
    	prevText: "",
    	nextText: "",
    	pauseOnHover: true
      });
    });
    </script>
       <?php
       global $dynamic_featured_image;
           $featured_images = $dynamic_featured_image->get_featured_images( );
       ?>
       <div id="flexslider" class="flexslider">
    		<ul class="slides">
    		<?php foreach($featured_images as $images) {?>
    
    <li>
    		<a href="#">
    		<img src="<?php echo $images['full']; ?>"/>
    		</a>
    		</li>
    		<?php }?></div>

    Plugin Author Ankit Pokhrel

    (@ankitpokhrel)

    Hi Rick,

    Looks like you forgot to wrap code with <?php tag. Try this:

    <?php $mh_newsdesk_options = mh_newsdesk_theme_options(); ?>
    <?php get_header(); ?>
    
    <div class="mh-section mh-group">
    	<div id="main-content" class="mh-content">
    		<?php mh_newsdesk_before_post_content(); ?>
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<?php get_template_part('content', 'single'); ?>
    			<?php mh_newsdesk_socialise(); ?>
    			<?php mh_newsdesk_postnav(); ?>
    			<?php if ($mh_newsdesk_options['author_box'] == 'enable') { ?>
    				<?php get_template_part('template', 'authorbox'); ?>
    			<?php } ?>
    			<?php if ($mh_newsdesk_options['related_content'] == 'enable') { ?>
    				<?php get_template_part('content', 'related'); ?>
    			<?php } ?>
    			<?php endwhile; ?>
    			<?php comments_template(); ?>
    		<?php endif; ?>
    	</div>
    	<?php get_sidebar(); ?>
    </div>
    <?php get_footer(); ?>
    <?php
    if( class_exists('Dynamic_Featured_Image') ) {
         global $dynamic_featured_image;
         $featured_images = $dynamic_featured_image->get_featured_images( 2 );
    
        //You can now loop through the image to display them as required
        //For example
        foreach( $featured_images as $image ) {
            echo "<a href='{$image['full']}'>";
                echo "<img src='{$image['thumb']}' alt='Dynamic Featured Image' />";
            echo "</a>";
        }
     }

    Regards,
    Ankit

    Thread Starter Rico

    (@nascas)

    Nope. I tried that yesterday and I didn’t work either.
    Maybe it has something to do with this value: $featured_images = $dynamic_featured_image->get_featured_images( 2 );

    What does number 2 stands for?
    I’d like all selected featured images to slide infinitely …

    Plugin Author Ankit Pokhrel

    (@ankitpokhrel)

    Hi Rico,

    Yes that seems to be the problem. 2 is the post id. Remove it and this should work.

    Regards,
    Ankit

    Thread Starter Rico

    (@nascas)

    Hi,
    Still nothing.

    I tried
    $featured_images = $dynamic_featured_image->get_featured_images;
    and
    $featured_images = $dynamic_featured_image->get_featured_images();

    Perhaps the plugin is incompatible with this theme?

    Plugin Author Ankit Pokhrel

    (@ankitpokhrel)

    The plugin is independent of the theme. Can you send your site details to info [at] ankitpokhrel.com.np? Also mention which file I need to check.

    Regards,
    Ankit

    Hi,

    I have installed the dynamic featured image plugin. But the admin end post add page not displayed additional feature image add section.Please help me.I checked t in top of screen options, but no Featured image-2 option available there.

    Thread Starter Rico

    (@nascas)

    Hello Ankit,
    Did you perhaps take a look at the mail I have sent you?
    Thanks,
    R

    Plugin Author Ankit Pokhrel

    (@ankitpokhrel)

    @rico I can’t find your email. Is it with the same name as here?

    @murugan5023 Please try the following temporary steps to troubleshoot:

    Switch to the Twenty Fifteen theme
    Deactivate all of your plugins, no exceptions
    Clear your browser’s cache and cookies
    Re-login and visit the admin backend and see if that resolves it

    Do you still get the problem when you do that?

    Thanks Ankit, I will check and inform you.

    Thread Starter Rico

    (@nascas)

    Ankit, no, this is my nickname. But I will change it and send it to you once again!
    Thank you!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Nothing is working’ is closed to new replies.