Black Friday Sale! Get up to $40 off GP Premium!Learn more

GP Portfolio Child Theme + CPT

Home Forums Support GP Portfolio Child Theme + CPT

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #160356
    Roberto 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:

    http://portfolio.artomultiplo.net/

    //////////////////////////////////////////////////////////////////////////////////////////

    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:

    https://wordpress.org/plugins/portfolio-post-type/

    for better understanding what’s in there you can read here: https://github.com/devinsays/portfolio-post-type and the home page of the plug-in over here: http://wptheming.com/portfolio-post-type

    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 it

    #160389
    Tom
    Lead Developer
    Lead Developer

    Hi Roberto,

    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 🙂

    #160395
    Roberto 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.

    #160396
    Tom
    Lead Developer
    Lead Developer
    #164698
    Roberto 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!

    #164883
    Roberto Enrique

    Update!

    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

    🙂

    #164989
    Roberto 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:

    http://premium.wpmudev.org/forums/topic/a-rare-permalink-issue-in-multisite-affecting-cpts-archive-page#post-1012337

    #165077
    Tom
    Lead Developer
    Lead Developer

    Interesting – thanks for posting the solution! 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.