Support » Plugin: The Piecemaker 2 » [Plugin: The Piecemaker 2] Display in Header and not in POST / PAGE

Viewing 15 replies - 1 through 15 (of 31 total)
  • You can use the function “function replaceBooks($att, $content = null){}”

    Look at the source code (file piecemaker-main.php line 1974) to see what parameters you should pass to the function. You should be able to call a piecemaker anywhere you want just using the id like this:

    replaceBooks(array(‘id’ => some-id));

    Haven’t tried it yet, but i should be testing this in a couple of hours so i’ll get back here with the results.

    Thanks for the suggestion Halles,

    will give it a try.

    Also I really dont know,

    what parameters you should pass to the function.

    As i dont have much knowledge about php [im just learning]

    You only need o pass it the piecemaker’s id. For example, if you Piecemaker has id 2, execute this:

    replaceBooks( array( 'id' => 2 ));

    Matías

    Guys, I need your help.

    When I paste the code: replaceBooks( array( ‘id’ => 5 )); (5 is my current piecemaker ID) and then refresh my website only the code will show.

    Can some please help me to get the right code that wil do the trick?

    Thanks
    Marc

    When adding it in a post, type [piecemaker id=”5″] in the editor, in the place you want to display it 🙂

    the replaceBooks should be used when you want to call a Piecemaker from within you template code.

    Thanks Halles for your info.

    Adding piecemaker in a post or page isn’t a problem.
    I want to change my header, a 900×350 px size, to a piecemaker slider.

    When I delete the code who defines the current .jpg for the header and change it into replaceBooks( array( 'id' => 5 )); a error wil show on my page.

    Is there any solution to solve this problem?

    Ok, i had it all wrong :p

    What i did was create a function which calls the $pm instance of the PiecemakerMain class.

    The function goes like this, and should be placed inside your functions.php file

    /**
    	 * Function to use piece maker outside post content
    	 *
    	 **/
    
    	function display_piecemaker($att = null){
    		global $pm;
    
    		if(!is_array($att)){
    			$att = array(
    				'id' => $att,
    			);
    		}
    
    		echo $pm->replaceBooks($att);
    	}

    Then you would call this function from anywhere on your template like this, being 1 the id of the desired piecemaker:

    display_piecemaker(1);
    or
    display_piecemaker(array('id' => 1));

    The second way of calling it, is because you can also pass the width and height as parameters (use them as array keys in the array).

    This function should work on the original plugin since i’ve been fiddling around with it and changing a lot of stuff.

    If it doesn’t work as is just ask and please attach the errors it may spit out 🙂

    It works!

    Thanks Halles!

    it worked for me also!! Thanks halles!

    Awesome tip halles. That displayed for me as well. But for some reason once it loads the first image it doesn’t transition to the next. The other slides are listed beneath it as they should be, but it doesn’t move on and you can’t click on the next slides. Anyone else have this trouble or know how to fix it? Thanks.

    40cooper i don’t really know what could be happening… i have that behaviour when adding flash assets (haven’t looked into it on how to fix that).

    Have you checked if the assets are being correctly uploaded?

    Did you add transitions to the piecemaker?

    Maybe the transitions are the problem. I have a couple themes that have this plugin built in. When I added it to this other site with a different theme I assumed it had a default transition in place. I’ll try adding them manually and see what happens. Thanks.

    Alright, that didn’t seem to help me. The site is http://www.blocks.pro is anyone wants to see what it’s doing. I’ll try disabling my plugins also. It’s a buddypress site too, maybe that’s causing a conflict??

    Hi all I got a lot of errors when I page the code in the function.php when i paste it. could someone share the good function code please thanks

    Thanks for the knowledge here!

    I feel like I’m sooo close to getting it to work in my header. I don’t think I’m pasting something in correctly. is there a certain place or way to paste that code into the functions.php? I tried at the very bottom and in the middle somewhere. this what i tried to do:

    http://pastebin.com/LE6a43vV

    ^^That has my functions.php and my template file

    but all i get is blankness

    Also, incase you need to see it. my website in question is http://www.uprockaudio.com

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘[Plugin: The Piecemaker 2] Display in Header and not in POST / PAGE’ is closed to new replies.