Help with wordpress plugin, php

Discussion in 'PHP' started by dekree81, Jan 13, 2010.

  1. #1
    I'm new with PHP.

    I have a wordpress plugin, which I just installed, that displays my designed zazzle's t-shirt on my website (powered by wordpress; self-host). It requires a shortcode, [zazzle rows="3" cols="3"], but that only works in the pages and posts. I want to place it on my website's template, just before the footer.php's first line, '</div>'. I tried to put its shortcode [zazzle rows="3" cols="3"] at footer.php & saved my amendment but it appeared as a text on my website. In other word, that shortcode doesn't work outside page (page.php) & post (post.php).

    To help you help me, this is from the plugin's php (part of it):

    // Shortcode handlers
    add_shortcode('zazzle', 'zazzle_shortcode');
    function zazzle_shortcode($atts) {
    	$shortcode_atts = shortcode_atts(array(
    		rows => 4,
    		cols => 4,
    		
    	), $atts);
    
    	return fetch_gallery($shortcode_atts);
    }
    Code (markup):
    I want to create a php code something like this ... (below) ... so that I can place it on footer.php.

    My proposed codes:

    <?php if (function_exists('zazzle_shortcode')): ?>
    <?php zazzle_shortcode('array(3,1)'); ?>
    <?php endif; ?>
    Code (markup):
    or
    <?php if (function_exists('zazzle_shortcode')): ?>
    <?php zazzle_shortcode('rows="3" cols="1"'); ?>
    <?php endif; ?>
    Code (markup):
    Obviously my proposed codes are wrong/not-functioning and hence, I am asking for your help. It could be very easy for you but isn't for me.

    Many thanks in advance.
     
    dekree81, Jan 13, 2010 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?php
    echo fetch_gallery(array('rows' => 3,'cols' => 3));
    ?>
    PHP:
    Try that
     
    JAY6390, Jan 14, 2010 IP
  3. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #3
    I think you should do this?

    do_shortcode('[zazzle rows="3" cols="3"]');
    PHP:
     
    ads2help, Jan 14, 2010 IP
  4. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yep, that is a better idea, go with that (although you might need to echo it too)
     
    JAY6390, Jan 14, 2010 IP
  5. dekree81

    dekree81 Peon

    Messages:
    202
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It seems to work! But currently, zazzle's server not responding, will try again later. Thank you guys.

    <?php echo do_shortcode('[zazzle rows="3" cols="3"]'); ?>
    Code (markup):
    :)
     
    dekree81, Jan 14, 2010 IP
  6. dekree81

    dekree81 Peon

    Messages:
    202
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    An update from me. It works!

    Thank you very much, JAY6390 & ads2help!
     
    dekree81, Jan 14, 2010 IP
  7. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #7
    No problem :)
     
    JAY6390, Jan 14, 2010 IP