• Resolved aaaronscat

    (@aaaronscat)


    I am attempting to write some PHP to display the rotating widget from my custom template. I can get the list to show up but not the rotating widget.

    This is the code I am using to display the list:

    <?php
    $args = array(
    ‘limit’ => 1,
    ‘random’ => true,
    );
    echo testimonialswidget_list_shortcode( $args );
    ?>

    What code do I use to display the rotating widget instead? The code you have on your FAQ #1 is not working for me.

    Thanks!

    Great plugin!

    http://wordpress.org/extend/plugins/testimonials-widget/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Cannon

    (@comprock)

    Thank you for the compliment.

    First off, bad copy and paste. testimonialswidget_list_shortcode vs. testimonialswidget_widget.

    Second, just use <?php echo testimonialswidget_widget(); ?>.

    limit=1 means to only pull one testimonial. Therefore, how can you rotate if there’s only one?

    Thread Starter aaaronscat

    (@aaaronscat)

    Hi Michael,

    It’s really great to get a reply from the actual plugin author so thanks a bunch for writing back.

    The only code that doesn’t give me an error message or break the entire site is the one I posted above. This one:

    <?php
    $args = array(
    ‘limit’ => 1,
    ‘random’ => true,
    );
    echo testimonialswidget_list_shortcode( $args );
    ?>

    I tried all of these and none of them worked:

    testimonialswidget_widget
    testimonialswidget_widget_shortcode
    testimonialswidget_list

    All of these functions gave me an error message on the page saying that they are undefined. Do I need to first define them somewhere?

    I tried putting <?php echo testimonialswidget_widget(); ?> in my functions.php like you suggest in your FAQ but this broke the whole site.

    Aaron

    Plugin Contributor Michael Cannon

    (@comprock)

    Is Testimonials Widget plugin activated?

    Please double-check and then if the <?php echo testimonialswidget_widget(); ?> code breaks again, copy and paste the error message here.

    Thread Starter aaaronscat

    (@aaaronscat)

    Yes, the plugin is activated. That would be the easiest solution I suppose.

    Sorry to be dense but should I put <?php echo testimonialswidget_widget(); ?> into my functions file or use it in my template?

    When I put <?php echo testimonialswidget_widget(); ?> into my homepage template I get this error message on the page itself:

    Fatal error: Call to undefined function testimonialswidget_widget() in /home/content/14/5985714/html/subdomains/karen/wp-content/themes/ksquared/tmp-home.php on line 43

    When I put <?php echo testimonialswidget_widget(); ?> into my functions.php the whole site is broken.

    Aaron

    Plugin Contributor Michael Cannon

    (@comprock)

    Aaron,

    You can put the <?php echo testimonialswidget_widget(); ?> code into the template file directly, where you want Testimonials Widget to display.

    It sounds like your theme is loading up before the plugins. I’m not sure if this is normal behavior or not. Therefore, you might try to fuller code before to include your one-off.

    <?php
    include_once( WP_PLUGIN_DIR . '/testimonials-widget/testimonials-widget.php' );
    echo testimonialswidget_widget();
    ?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Writing PHP to display Rotating Widget in a template’ is closed to new replies.