Hard-code plugins into page template

I'm starting to build a template page for the site I am creating. This page will have the same plugins all the time for everyone who uses it. I need to build the template because I want to have it show up for the people when they add a new page and all they will have to do is add their comments and photos,etc to it. Since all the plugins are the same for everyone and I don't want to try to let them add the plugins themselves (this site is going to be for not-very-tech-savvy people) I want to go ahead and just code the plugins into the template so they will always be there. I know I will have to keep an eye out for updates to make sure nothing breaks but I still feel this is my best option. I'm working on the page now and have a content area set up and a couple of sidebars but my question is how do I actually code the plugins into the template page? Is this done through the use of short codes? I'm hoping this won't be too difficult. I have quite a bit of coding behind me but my expertise has always been .net framework so this is still a little new to me but I am having a blast working on this and figuring out a lot of this. Any help on this would be greatly appreciated!

Thanks

Dustin

  • PC

    Hello Dustin,

    Greetings and thanks for your post.

    By hardcoding plugins, I hope that you are talking about hardcoding the widgets.

    Here are a couple of links to get you started on it

    https://premium.wpmudev.org/blog/how-to-widgetize-a-page-post-header-or-any-other-template-in-wordpress/

    here is a plugin : http://wordpress.org/plugins/widget-logic/

    here is another post about the same topic : https://premium.wpmudev.org/forums/topic/hardcode-widget-into-sidebar#post-123537

    I hope that helps. Please feel free to ask if you have more questions on the same.

    Cheers
    PC
    Sales &Support

  • Dustin

    Morning @PC

    Thanks for the links. I am in the middle of coding the template page now and have gotten some of the widgets hardcoded in and working with no issues so far (except the nextgen gallery widget doesn't want to rotate for some reason but I'm looking into that one; it works when not hardcoded but not working when hardcoded). At least I'm making progress and getting there. Right now trying to get all my formatting done so the page looks exactly the way we want it to so just a little time consuming but not as bad as I thought.

    Thanks again for those links!

    Dustin

  • Dustin

    A couple of the widgets I have to hardcode in are galleries (one video and one photo). Is there a way to hardcode this in without any galleries included and then let the user add the galleries? Basically, each page will have individual galleries. I realize these might have to all be listed together but I figure they can select which gallery they want on that page. It seems like everytime I get almost finished, I find something that is stopping me!!

    Thanks

    Dustin

  • PC

    Hello Dustin,

    While I am not a developer, I am still confused on what you are trying to achieve by hard coding a widget and not adding any content to it ?

    Just to avoid users from using another widget in that area ?

    I don't see it possible without some custom piece of code as it will include adding a widget area to your page template and then forcing it to allow only a certain widget.

    I will suggest you to post a job requirement here as well : https://premium.wpmudev.org/wpmu-jobs/

    Cheers
    PC
    Sales &Support

  • Dustin

    Hi PC

    The reason for the no content is because they are going to be galleries (like video and photo) but when they initially create the page, they won't have any videos or pictures in them until they add them. The reason for the hardcoding is because it is going to be a standard page all users will have when they create new pages in their sites. They will all have the same layout with the galleries, donation area, etc and they will be able to change header, background, pictures, videos, etc but they all have to have the same widgets. This page is being designed for completely non-tech people who will use the site so we are making everything as easy as possible. I am actually making it so they won't actually even go to the admin page to make any of these changes; I'm creating links on the page itself that will only show for the admin of the site that will take them directly where they have to go so they don't have to try to find anything. It's a pain but that is what I have been told how they want it so I am trying to make it as close as possible. I'm getting pretty close to finishing it and the template page is one of the last pieces left. I think I have found a solution to this where the galleries can be there but it will say something to the effect of no content in gallery until they add stuff to the gallery and set the gallery id for each one. I am going to have one place for them to set up all the galleries and then on these pages, they will have a drop down list that shows all available galleries and they will be able to select which one they want for each one. Hopefully I can get this completed this weekend and I will let you know how it goes.
    Thanks again for all the help!

    Dustin

  • Dustin

    Hey PC

    I have finally made some headway on this. I am using advanced custom fields plugins with the nextgen extensions for relationships and that adds a part under the manage galleries to link gallery to page and then I was able to run a sql query against the gallery table to get the gallery id of the gallery for the current page by comparing current page id to the page id in the gallery table and use that variable in the php shortcode in my template file. It seems to be working and it is completely dynamic. I can give better details to anyone who wants to know more or I might try and provide a little more detail later this week when everything slows down a little so hopefully someone else can take advantage of this as well.

    The articles you provided were also a great help in the general hardcoding of regular plugins and it was just a lot of diligence and hard work that got the photo gallery figured out (and research galore on google). I'm getting ready to see if I can do something similar to the video gallery now and see where I can go from there.

    It really wasn't that bad to do once I found the correct items!

    Thanks for the assistance again!

    Dustin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.