WordPress.org

Forums

The Piecemaker 2
Display in Header and not in POST / PAGE (32 posts)

  1. snaushads
    Member
    Posted 4 years ago #

    Hi,

    I want to display Piecemaker in header,

    Please assist on the steps for the same.

  2. halles
    Member
    Posted 4 years ago #

    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.

  3. snaushads
    Member
    Posted 4 years ago #

    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]

  4. halles
    Member
    Posted 4 years ago #

    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

  5. itsmarc
    Member
    Posted 4 years ago #

    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

  6. halles
    Member
    Posted 4 years ago #

    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.

  7. itsmarc
    Member
    Posted 4 years ago #

    Thanks Halles for your info.

    Adding piecemaker in a post or page isn't a problem.
    I want to change my header, a 900x350 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?

  8. halles
    Member
    Posted 4 years ago #

    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 :)

  9. itsmarc
    Member
    Posted 4 years ago #

    It works!

    Thanks Halles!

  10. cvenegasf
    Member
    Posted 4 years ago #

    it worked for me also!! Thanks halles!

  11. 40cooper
    Member
    Posted 4 years ago #

    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.

  12. halles
    Member
    Posted 4 years ago #

    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?

  13. 40cooper
    Member
    Posted 4 years ago #

    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.

  14. 40cooper
    Member
    Posted 4 years ago #

    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??

  15. eyesperture
    Member
    Posted 4 years ago #

    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

  16. footwords
    Member
    Posted 4 years ago #

    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

  17. peterson.julia
    Member
    Posted 4 years ago #

    If I want to display it I would just simply insert the mentioned code in functions.php and in header.php -> <?php display_piecemaker(array('id' => 1)); ?> ??? Well it doesn't work...what am I dong wrong? (Piecemaker2) Thx

  18. jeremyers1
    Member
    Posted 3 years ago #

    I am having same problem as peterson.julia. Did you find any fix?

    I created an asset, and created a piecemaker. I inserted the code in functions.php and the following code in the proper place of my index.php:

    <?php if( is_home() ) {
    display_piecemaker(array('id' => 1));
    }
    ?>

    All that shows up is a big giant blank space. When I right click on it, I see that there is a Flash element there, but nothing shows up.

  19. ddman
    Member
    Posted 3 years ago #

    I was experiencing the same problem. For some reason the Piecemaker only appears if the dimensions are 960x380...

    Anyone else experiencing this problem?

  20. fegw
    Member
    Posted 3 years ago #

    It works for me, thank you!
    But I have another question: how can I centralize the piecemaker in my homepage?

  21. fermk090
    Member
    Posted 3 years ago #

    I have the same question as you fegw ....

  22. kke
    Member
    Posted 3 years ago #

    Hi everyone. I am having same problem as jeremyers1. Its just blank flash-player object. How to solve this problem?

  23. MTPrower
    Member
    Posted 3 years ago #

    I have the same problem as jeremyers1 and kke. Can someone please help?

  24. MTPrower
    Member
    Posted 3 years ago #

    Alright, I actually fixed that problem by adding transitions. But now, like 40cooper, I can't get the second transition to start and more images to display.

  25. MTPrower
    Member
    Posted 3 years ago #

    Alright, I got it working by fixing the transition speed. It was way too slow. But now I can't get other transitions working besides the one that rubber-bands all the boxes out and then back in...

  26. MTPrower
    Member
    Posted 3 years ago #

    Alright, I fixed this one by changing my transition offset and cube distance.

  27. dhobeika
    Member
    Posted 3 years ago #

    I tried putting the following code in my theme's 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);
    	}

    And then I put the following code in my header file where I want the piecemaker slideshow to appear:

    <?php {display_piecemaker(1);
    }
    ?>

    But I am getting the following error when I do so: Fatal error: Call to a member function attributes() on a non-object in /wp-content/plugins/piecemaker/piecemaker-main.php on line 1981

    What am I doing wrong and how can I fix this?

  28. holden2
    Member
    Posted 3 years ago #

    Hello,

    I used the code above to get the piecemaker up and running on my site.

    But, when I put it in my header, the links above the piecemaker stop working. Not sure what is going on, but on my subpages the links up top work fine.

    Anyone have any ideas?

  29. redi4show
    Member
    Posted 3 years ago #

    good job man big THX halles !!

    I'm nota programmer but it was helpful I use piecemaker in sidebar the way u explained ! :)

  30. lordhell
    Member
    Posted 3 years ago #

    Hey, thanks for you help, I managed to get it running, but I have problem with centering the object. I've tried many codes, but none is working, the header is still on the left side.

    <?php if( is_home() ) {
    display_piecemaker(array('id' => 1));
    }
    ?>

    Can you help me how to center this code? I'm using Scarlett Theme. Put this code in slide.php, it works fine, but I need it in center, where and what to do now? Can you please help me I'm desperate.

    Thank you so much.

    There's example how does it look like on my webpage, the shadow of slide is ok I guess it's just wrong setup in slide settings in wordpress admin...
    CLICK

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic