WordPress.org

Ready to get started?Download WordPress

Forums

Meta Slider
[resolved] Where to insert PHP - CyberChimp Responsive Theme (11 posts)

  1. agentbey
    Member
    Posted 9 months ago #

    I'm using CyberChimp Responsive Theme and placed the PHP code in the home.php located in my child theme folder. I put the php code there but no results on the homepage.

    URL: http://lovehealth-addiction.com/

    <div id="featured" class="grid col-940">
    		<?php echo do_shortcode("[metaslider id=298]"); ?>
    </div><!-- end of metaslider -->

    http://wordpress.org/plugins/ml-slider/

  2. Matcha Labs
    Member
    Plugin Author

    Posted 9 months ago #

    Hi agentbey,

    Could you confirm is that's the right URL? Its not working for me at the moment (but my internet is being a bit dodgy..)

    Regards,
    Tom

  3. agentbey
    Member
    Posted 9 months ago #

    Correction: http://lovehealth-addiction.com

    Wow. That was a quick response. Thanks!

  4. Matcha Labs
    Member
    Plugin Author

    Posted 9 months ago #

    Hi agentbey,

    Please try adding it to the front-page template, see this screenshot:

    http://screencast.com/t/B3Tje2gGKX

    Regards,
    Tom

  5. agentbey
    Member
    Posted 9 months ago #

    Hmmmm. I put <?php echo do_shortcode("[metaslider id=298]"); ?> this code in that exact spot, refreshed the browser and I don't see the slider.

  6. Matcha Labs
    Member
    Plugin Author

    Posted 9 months ago #

    Hi,

    It looks like the theme uses different templates depending on your theme settings.

    Please try putting the code in header.php instead, your theme settings shouldn't matter then: http://screencast.com/t/yI360RVx64fp

    Regards,
    Tom

  7. agentbey
    Member
    Posted 9 months ago #

    Tom,

    Update I made an adjustment to the theme's settings: See below.
    Enable Custom Front Page [] Overrides the WordPress front page option

    The slider appears here but I'm didn't want to use that front page option. I would like to have it appear on the home.php.

  8. agentbey
    Member
    Posted 9 months ago #

    I have a work around using trail and error. Look like right now I have to use the front-page option. It's working. I'll have to contact the theme developers to address this. Thanks for you input it was very helpful.

    See the results here:
    http://lovehealth-addiction.com/

  9. Matcha Labs
    Member
    Plugin Author

    Posted 9 months ago #

    Hi agentbey,

    I've been playing around with this a bit. If you add this to your themes functions.php file you should find a new drop down menu in the responsive theme settings (under homepage) to allow you to choose a homepage slideshow.

    /**
     * Add Meta Slider dropdown selector to homepage settings
     */
    add_filter('responsive_options_filter', 'metaslider_responsive_theme_sections', 10, 1);
    function metaslider_responsive_theme_sections($options) {
        $slideshows[0] = 'Disabled';
    
        // list the tabs
        $args = array(
            'post_type' => 'ml-slider',
            'post_status' => 'publish',
            'suppress_filters' => 1, // wpml, ignore language filter
            'posts_per_page' => -1
        );
    
        $the_query = new WP_Query($args);
    
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $slideshows[$the_query->post->ID] = get_the_title() . ' (ID: ' . $the_query->post->ID . ')';
        }
    
        $options['home_page'][] = array(
             'title'       => __( 'Meta Slider', 'responsive' ),
             'subtitle'    => '<br />Recommended width: 960px',
             'heading'     => '',
             'type'        => 'select',
             'id'          => 'homepage_meta_slider',
             'description' => '',
             'placeholder' => '',
             'options'     => $slideshows
         );
    
        return $options;
    }
    
    /**
     * Output the slideshow to the 'header_end' section of the theme
     */
    add_action('responsive_header_end', 'metaslider_responsive_homepage_slider', 10, 1);
    function metaslider_responsive_homepage_slider() {
        $theme_options = get_option('responsive_theme_options');
    
        if ((is_front_page() || is_home()) && isset($theme_options['homepage_meta_slider'])) {
            $slider_id = $theme_options['homepage_meta_slider'];
    
            if ($slider_id > 0) {
                echo do_shortcode("[metaslider id={$slider_id}]"); //replace 123 with slider ID
            }
        }
    }

    Regards,
    Tom

  10. agentbey
    Member
    Posted 8 months ago #

    I will try this out thanks for the input. Really appreciate it.

    Cheers!

  11. LasseNielsen
    Member
    Posted 8 months ago #

    Hey,

    I sort of have the same problem.
    I have deleted some things in the theme and will add a meta slider on my front page. I am using Responsive Theme.

    I have added the meta slider in front-page.php and it works fine on my localhost but not on my domain ansagerif.dk

    Here you can see that the slider works fine on localhost:

    you can here see that the codes are the same at local and ansagerif.dk

    ansagerif.dk

    localhost

    Hope i have explained it well so you can help me.

    Thanks

    LasseNielsen

Reply

You must log in to post.

About this Plugin

About this Topic