- This topic has 7 replies, 2 voices, and was last updated 5 years, 8 months ago by Tom.
December 16, 2015 at 4:35 am #160356Roberto Enrique
I’m trying my best to integrate simple portfolio functionality to GeneratePress.
I would really like to add all the functionality into a plug-in instead of plugin + child theme but I’m not very skilled neither I have the time required to dig deeper so here I am, explaining and sharing the results of what I’m doing right now.
The demo website can be found here:
I was thinking to create everything from the ground using some tutorials that you can easily find by yourself but while searching information regarding creating CPT’s plug-ins I stumbled upon this plug-in which does exactly what we need. I’m using it as an starting point:
Right now I’ve created a Child theme to do the stuff I’m talking about here. Be warned! It is rough, but it works.
You can download the child theme here: http://www.artomultiplo.net/extra/gp-portfolio.zip
Now, let me explain you what it does, basically:
– The aforementioned plug-in registers a Custom Post Type called “Portfolio” and as soon as you activate it you’ll be able to add portfolio items with categories and taxonomies. Nice
– archive-portfolio.php displays the portfolio items in tree columns using also content-portfolio.php
– I could create a single-portfolio.php but you can fine grain how your single portfolio entries show up just using the add-on’s we already know in the single portfolio items. Easy
– In the functions.php I’ve placed some code in order to create a shortcode for querying those portfolio items so you can just add
[list-portfolio-items]and magically you’ll have a tree column layout showing your portfolio items’ featured image.
That’s itDecember 16, 2015 at 9:57 am #160389TomLead DeveloperLead Developer
Very cool! Thanks for sharing!
Is the only purpose of plugin to register the post type? If so, why not just add it to functions.php?
Thanks again for posting, going to sticky this 🙂December 16, 2015 at 10:15 am #160395Roberto Enrique
I prefer not to add content-creating features on theme realm. This way, if you want to change your theme in the future you will always have your post type over there.December 16, 2015 at 10:22 am #160396TomLead DeveloperLead DeveloperJanuary 10, 2016 at 1:44 am #164698Roberto Enrique
If you use this child theme in a single standard WordPress installation it works just as you expect it should, but there are some small issues in multisite, regarding “portfolio” archive page that I’m trying to solve right now, may be with a little help from you 😉
First, let me explain my configuration.
* I’m running a multisite network on a shared host and everything is running smoothly, the main network site is http://www.artomultiplo.net
* Some sites are using WPMUDEV’s Domain Mapping plugin (so websites like mastromiliano.artomultiplo.net appears as mastromiliano.it)
* In that shared host I have some other websites that are not connected to the main network (they’re just add-on domains pointing to sub-folders, some of them are just sub-domains always pointing to a sub-folder)
* There is an “isolated” installation of wordpress (a stand-alone vanilla installation of wordpress, not a sub-site of the multisite) that I use just to show a child theme I put together to allow a simple integration of wp-theming’s “Portfolio Post Type Plugin” (http://wptheming.com/2011/08/portfolio-post-type-plugin/). The url of that site is portfolio.artomultiplo.net and it works as expected BUT…
I realized that, while the plugin is actually working for the sites on the main multisite, as you can see here: http://mastromiliano.it/portfolio/candelabro-144/ if you go to the “archive” of that website, which should just work when you add the “portfolio” slug at the end of the url (wether you use this path mastromiliano.artomultiplo.net/portfolio or mastromiliano.it/portfolio) you land in portfolio.artomultiplo.net but the url is right :-S
If I “delete” the “isolated” website that contains the portfolio child theme (portfolio.artomultiplo.net) then in mastromiliano.net/portfolio you can see what is intended to, the mastromiliano.it portfolio archive page, but it does not work (the archive page with the portfolio slug) in other sites of the network. (let’s say http://detech.it/portfolio/this-is-a-portfolio-item/ while http://detech.it/portfolio/ does not)
To say it short: My problem is with Archives for portfolio post type, they behave very weirdly when they work. Is there a way to just display the portfolio archive page of the sub-site and not the portfolio.artomultiplo.net homepage?
Thanks in advance, and have an awesome weekend you all!January 10, 2016 at 12:57 pm #164883Roberto Enrique
While looking for the solution of the aforementioned issue I took the time to make a little cleanup and added a subtle hover effect to the shortcode that lists the posts.
You can always see the results here: portfolio.artomultiplo.net
🙂January 11, 2016 at 2:22 am #164989Roberto Enrique
Ok, problem solved. It was all my fault.
The problem was that inside my own CPanel configuration of subdomains and subfolders 🙂
If you’re curious about it look at this thread:January 11, 2016 at 10:22 am #165077
- You must be logged in to reply to this topic.