Support » Plugin: Slideshow » Add a type of slide

  • Resolved Vince4x4

    (@vince4x4)


    Hi,

    I’m using your slideshow plugin for some specific uses so I would like to create my own type of slides so that I don’t need to put too much html code in Text Slides.
    I managed to create the button in the admin panel, but when I click it, no box is added to the list below.
    There are no javascript error as I created the function slideshowSlideInserterInsertTeamSlide in slide-insert.js

    I guess the problem is I didn’t found every file I had to modify, that’s why I’m asking here what I missed. Here is the list of the files I modified so far :

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    * classes/SlideshowPluginPostType.php
    I added "SlideshowPluginSlideInserter::getTeamSlideInsertButton() ." at line 206 so that the button is displayed in the admin
    
    * classes/SlideshowPluginSlideInserter.php
    I created the getTeamSlideInsertButton function which is the same as other functions of this type : I just changed the file which is included.
    
    * js/SlideshowPluginSlideInserter/slide-inserter.js
    I created the slideshowSlideInserterInsertTeamSlide function with basically the same code as slideshowSlideInserterInsertTextSlide. I only changed attributes of the TeamSlide object :
    
    // Set names to be saved to the database
    		teamSlide.find('.title').attr('name', 'slides[0][title]');
    		teamSlide.find('.personne').attr('name', 'slides[0][personne]');
    		teamSlide.find('.photo').attr('name', 'slides[0][photo]');
    		teamSlide.find('.description').attr('name', 'slides[0][description]');
    		teamSlide.find('.type').attr('name', 'slides[0][type]');
    		teamSlide.find('.slide_order').attr('name', 'slides[0][order]');

    I also added the click function :

    /**
    	 * Insert team slide into the sortable list when the Insert Team Slide button is clicked
    	 */
    	jQuery('#slideshow-insert-team-slide').click(function(){
    		slideshowSlideInserterInsertTeamSlide();
    	});

    For the display, I will add frontend and backend files (I didn’t create these for now) but I don’t think this could interfere in the admin panel.

    So there I am, I searched in other files but I didn’t find what was needed.

    http://wordpress.org/extend/plugins/slideshow-jquery-image-gallery/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Stefan Boonstra

    (@stefanboonstra)

    Have you added the template code for the slide as well? In the plugin folder there’s the ‘views/SlideshowPluginSlide/‘ folder where you’ll find the ‘backend_templates.php’ file (in version 2.2.0, that is).

    You should define your own template there. Not that there are no names for the fields defined in any of those templates, as the templates themselves must never be saved.

    To be able to show your custom slide back-end and front-end, you’ll also need to create the ‘backend_teamSlide.php’ and the ‘frontend_teamSlide.php’ files.

    Thread Starter Vince4x4

    (@vince4x4)

    Thanks, the box now displays well. The fields defined in the template are ok but when I update the whole slideshow, my custom slide is replaced by a video slide.

    I guess this is due to some parameters which was there with a copy/paste but I can’t find where. Where exactly is located the process of update for slideshow ?
    I should manage to deal with that once I find the correct file.

    Plugin Author Stefan Boonstra

    (@stefanboonstra)

    The type of slide is defined by its template.

    <input type="hidden" class="type" value="text" />
    <input type="hidden" class="type" value="attachment" />
    <input type="hidden" class="type" value="video" />

    And in your case:

    <input type="hidden" class="type" value="teamSlide" />

    The front-end and back-end files should be named like I mentioned before.

    I see that the JavaScript you posted above sets the wrong type for the teamSlide. It should look like this:

    teamSlide.find('.type').attr('name', 'slides[0][teamSlide]');

    Thread Starter Vince4x4

    (@vince4x4)

    Thanks, that was it. I forgot to change this hidden field.

    It works now. Thanks for the great support. 😉

    Plugin Author Stefan Boonstra

    (@stefanboonstra)

    That’s great to hear!

    Don’t forget you can’t update from now on, as you’d lose all your work when doing so. That would be a terrible waste. 🙂

    Thread Starter Vince4x4

    (@vince4x4)

    Just in case someone wants to do something similar. Here is what I did :

    Modify :
    – classes/SlideshowPluginPostType.php
    – classes/SlideshowPluginSlideInserter.php
    – js/SlideshowPluginSlideInserter/slide-inserter.js
    – views/SlideshowPluginSlideshowSlide/backend_templates.php
    Create :
    – insert-XXX-button.php in views/SlideshowPluginSlideInsert/
    – frontend_XXX.php & backend_XXX.php in views/SlideshowPluginSlideshowSlide/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add a type of slide’ is closed to new replies.