Convert portfolio modules to work with posts

If you find this tweak helpful:

Beginners

Tweaking Elegant Themes involves creating a child theme and editing PHP and CSS files within a text editor. If you have never done this you may want to read our guide on creating a child theme. All tweaks are written with the assumption that you have a default installation of your theme.  Any tweaks or changes you may have previously made to your theme could affect the outcome of the tweaks on this site. All tweaks should be tested before applying to a live site. 

When Divi first came out, I was immediately disappointed that I could not use the portfolio modules for posts. I finally received a request for a tweak to fix this and decided it would be worth the time. After performing this tweak, you will be able to use every portfolio module in the page builder with posts instead of projects. I was really excited about how well it turned out.

This tweak is no longer being maintained in its current form. It is now available as a plugin! Check out the demo on my new website dedicated to Divi plugins:

http://www.diviplugins.com

Now comes the fine print. There was so much involved in this tweak I decided instead of showing you what to change and where, I am going to instead provide the entire files that you will be downloading and replacing. These files are exact copies of the same files you'll find in Divi, with changes made to the portfolio modules allowing posts to be used instead of projects. I highly recommend you make backups of your current files in case something goes wrong. I have tested these files on live websites and they work great. Here we go.

To see a live example of this tweak, check out my and my wife's personal blog. I currently have the portfolio carousel loading posts. Here's a screenshot of the filterable portfolio loading posts and using post categories to filter.

One last catch. Uploading the two files below will remove the ability to use the portfolio modules with projects. You can not use posts in addition to projects, but rather in place of. All portfolio modules in the page builder will only work with posts, not projects. These files correspond with Divi 2.1.2. If you have a version other than 2.1.2, PROCEED WITH CAUTION!!! I have not tested it on any other version. At the very least, make a backup of the originals before you replace them with the files below.

UPDATE:

Hello everyone. This tweak is by far the most complicated of any of my tweaks. Due to the nature of having to replace files to get this to work, it is becoming a chore trying to keep up with the Divi updates. Now that Divi 2.4 is out and after looking at the code, it no longer makes sense to continue supporting this tweak in its current form. The good news is that I plan to convert this tweak into a plugin. It just makes more sense to create something that will not break with every Divi update. My time is limited but I hope to have this finished soon. Thank you for all of the kind words and support and stay tuned for the plugin! Be sure to sign up for the newsletter for updates on the plugin.

The beta version of the plugin is finished and can be downloaded here: http://www.diviplugins.com/plugins/portfolio-layout-posts/. Keep in mind that it does NOT currently work with Filterable Layouts AND does not work like the original tweak. It uses shortcodes. I'm hoping to change both of those in a future release. Documentation and Demo can be found at the bottom of the download page. Thanks and please give feedback if you run into any issues!

I have updated (and will continue to update) this tweak to work with the latest releases of Divi. Please download the version that corresponds to the version of Divi you have installed.

Download the functions.php file and upload it to your /themes/Divi/ folder, replacing the current functions.php file.

Divi 2.1

 

Divi 2.2

 

Divi 2.3

 

Divi 2.3.2

 

Download the et-pagebuilder.php file and upload it to your /themes/Divi/et-pagebuilder/ folder, replacing the current et-pagebuilder.php file.

Divi 2.1

 

Divi 2.2

 

Divi 2.3

 

Divi 2.3.2

 

That's it. The easiest method would be to use FTP or Cpanel. If these are not options, you can also use the built-in editor in the WordPress Dashboard. You'll just have to open the downloaded files in a text editor and copy and paste. Again, PLEASE BACK UP THESE TWO FILES BEFORE YOU REPLACE THEM OR MAKE ANY CHANGES. I am not responsible if your website breaks. If you follow the directions, download the correct files that corresponds to your version of Divi, and have not customized these two files in any way, you should be fine. Enjoy!

* If you are using the fullwidth carousel, you may want to add the following code to your stylesheet. I noticed some of the longer post titles interfered with the left and right carousel arrows. This just moves them down below the text:

.et-pb-arrow-prev, .et-pb-arrow-next {
top: 75%;
}

    58 Comments

  1. Can you please provide the link to the modified files? Thanks.

    Styro

    December 24, 2014

    • Sorry. Not sure what happened but the files seemed to have got up and walked away on their own. I’ve re-uploaded and they are now available.

      admin

      December 28, 2014

      • Thanks!

        Styro

        January 16, 2015

  2. Hey there! Am I going crazy? Because I can’t find the file to download… this looks like a GREAT tweak, and I am excited to try it. Am I just blind?

    Tobin

    December 28, 2014

    • Awesome! Thanks for uploading them! I am trying it out right now, but I am having a small issue with it.

      It no longer displays my projects (which is great) but is still not displaying my posts. When I go into my “Filterable Portfolio Module Settings” on the site builder, it is only allowing me to use categories from my projects, and not posts. Thoughts on how to fix it?

      Tobin

      December 28, 2014

      • Just kidding. I am dumb, got it! YOU ARE THE MAN!

        Tobin

        December 28, 2014

        • Thanks Tobin. Glad you found it useful!

          admin

          January 12, 2015

  3. I’ve been trying SO hard to do this whole child theme thing and I’m really struggling to know what to do when I find info like this.

    How would I use this replacement information in a child theme the proper way?

    I’ve tried just uploading them into the child theme folder which didn’t work at all. Even tried making it a ET-pagebuilder folder to put that file in and that didn’t work at all.

    I’d love to not be messing with the core files if possible.

    Dani Meyer

    December 28, 2014

    • After deciding to just bite the bullet and apply these to the core files it actually did not work for me. I even reuploaded and it did not work.

      The page builder is not accessible at all on pages.

      Bummed, really need this functionality! Silly that it is not natively working this way.

      Dani Meyer

      December 28, 2014

      • I am on the newest version of Divi also….I’m sure that is the issue. But doesn’t help me much. Can you post the code excerpts please so we can try to figure out what is different?

        Thanks so much for your help!

        Dani Meyer

        December 28, 2014

        • Hi Dani. Sorry you are having issues with this. I am looking into how to get this to work on Divi 2.2. No guarantees but hopefully I can figure it out based on what they’ve changed. Stay tuned. Thanks.

          admin

          January 12, 2015

        • Hi again Dani. I have updated the tweak to work with Divi 2.2. Make sure you download the second version of each file above. I have just tested the changes and everything works.

          Unfortunately this will not work with a child theme. I’m sure there is someone out there smarter than me who could figure it out. I’m just not that person πŸ™‚ I’m looking into making my tweaks available as a plugin in the future so hopefully I can get that going soon. Hope this is not too late for you and I apologize for the late response.

          admin

          January 12, 2015

  4. any ideas why it doesn’t work with the child theme…editing the core files is a no-no for me as will just break everything come update time!!

    craig

    February 10, 2015

    • I haven’t tried this yet, but it seems very weird that it wouldn’t work in a Child Theme. The way a Child Theme is supposed to work is that WordPress reads any files there first, so if you copied (for example) the entire footer.php file into your Child Theme folder and made “tweaks” to footer copyright, etc. it would work and be safe from Parent Theme (Divi) updates. Why wouldn’t the same apply to the functions.php and et-pagebuilder.php files? I have, in fact, put the functions.php file in my Child Theme before, but not the et-pagebuilder.php file so I wonder what’s up with et-pagebuilder?

      DebG.

      February 10, 2015

    • The functions.php file in WordPress does not work like other files in a child theme. Instead of replacing the parent theme’s function.php file, it works as an “in addition to” file. If you simply copied the file or specific function, the child theme function would load first but then the parent theme function would also try to load. You would get a “cannot redeclare function” fatal error.

      I am committed to updating my files as new versions of Divi are released, but I also understand that you would not want to edit the Divi core files. I personally love this tweak and usually don’t update the theme anyway unless there is a great new feature or security patch.

      Brad (admin)

      February 10, 2015

  5. Thank you so much for this – Its just what i was looking for. I notice that the sidebar shows when i use page builder posts and turning off side navigation in the post ET settings dropdown doesnt solve it. Am i missing something or is this something that can be fixed – turning off the sidebar when viewing certain posts.

    Many thanks

    Marc

    February 18, 2015

    • When using page builder, turning the sidebar off/on in ET settings will have no effect. That is all controlled from within the page builder. Just remove the sidebar module and it should disappear.

      Brad (admin)

      February 26, 2015

    • Jackie Adelia WrayJanuary 2, 2012 Had my v2 cigs for about 8 months now and IÒ€ℒve now had 3 real cigarettes in as many months. Their spare parts are actually affordable, as when I was researching I found that some companies tried to catch you out and over charge for these. You need a spare battery with you at all times so youÒ€ℒre not tempted to buy a pack of smokes! Love them!

      http://www.gamecoins.pro/

      February 28, 2017

    • / Thanks for weighing in Jim. I find your comment quite interesting, and I think we had all misinterpreted the idea of the sandbox. Reading your words on the consultant helping to configure the environment, I understand your concept to be that the future sales process is significantly more collaborative, which is a point absent in our original reading.Actually, any increase in collaboration in sales would be a good thing. I think we could further argue about how it should be implemented, but this idea might be a pretty good start.

  6. Exactly what I wanted and thank you… Sorry to bother you but I have this error with DIVI 2.3.1

    Notice: Undefined variable: show_pagination in /home/realteac/public_html/wp-content/themes/Divi/functions.php on line 4372

    Any help would be appreciated…

    Peter

    April 12, 2015

    • Hey Peter. I actually haven’t uploaded the version of this tweak for Divi 2.3.1 yet so probably why you’re getting an error. I’ll work on making it compatible with 2.3.1

      Brad (admin)

      April 19, 2015

    • I’ve updated the files to work with Divi 2.3.2, please update to that version of Divi and download the 2.3.2 files above.

      Brad (admin)

      April 28, 2015

  7. Hey Brad – is it ok to use this on 2.3.2? I seem to have upgraded and lost the tweak. I should make a child theme but have never done it before. Is it possible for me to make a child theme by copying the installation i have so that all the updates dont affect the tweak. Apologies for the novice question as i know there are guides online but im a bit worried to break anything as have spent weeks making the site. Many thanks for your excellent work

    Marc

    April 27, 2015

    • Hey Marc. I just uploaded the 2.3.2 versions of the files. It is possible to make the functions.php changes in a child theme so they would not get overwritten. Unfortunately it’s not possible to do the same with the et-pagebuilder.php. I’m sure there is a way to make it happen, but it would probably involve changing several references to the location of that file. I’m very hopeful Divi adds this tweak to the next major release and we won’t have to continue to do it manually πŸ™‚

      Brad (admin)

      April 28, 2015

      • Excellent – thanks Brad πŸ™‚

        Marc

        April 28, 2015

  8. Hey Brad, are you sure that the 2.3.2 version working? I lost the tweak here at my website : http://www.toyayatra.com after I made upgrade with your customization files. So now I use your 2.3 version along with Divi 2.3.2.

    I noticed that the images are missing in Portfolio Module, but not in Filterable Portfolio Module when using your 2.3.2 customization files.

    I hope I’m wrong but it would a great help if you can enlight me.

    Thanks, Man. You’ve done a great job so far.

    I’ve used your customization since the first version.

    Edo

    May 13, 2015

    • Nope, you were correct. Everything was working except the regular Portfolio Module. Sorry about that. I found the error and corrected it. Should be good to go now πŸ™‚ Very nice website btw. You are definitely putting the tweak to good use

      Brad (admin)

      May 14, 2015

  9. Genius, many thanks x

    Katherine

    May 14, 2015

  10. Hey Brad ~
    Thanks so much for doing all this work. I am having the same problem as Peter and getting this error:
    Undefined variable: show_pagination in /Users/KaiRocks/Wordpress/wp-content/themes/Divi/functions.php on line 4371
    I am also on Divi 2.3.1 and used your 2.3.2 update.

    In original 2.3.2 functions.php file there is this code around line 4371
    $args = array();
    if ( is_numeric( $posts_number ) && $posts_number > 0 ) {
    $args['posts_per_page'] = $posts_number;
    } else {
    $args['nopaging'] = true;
    }

    if ( '' !== $include_categories ) {
    $args['tax_query'] = array(
    array(
    'taxonomy' => 'project_category',
    'field' => 'id',
    'terms' => explode( ',', $include_categories ),
    'operator' => 'IN'
    )
    );
    }

    $projects = et_divi_get_projects( $args );

    In your updated version is this code:
    $args = array();

    if( 'on' === $show_pagination ) {
    $args['nopaging'] = true;
    } else {
    $args['posts_per_page'] = (int) $posts_number;
    }

    if ( '' !== $include_categories ) {
    $args['cat'] = $include_categories;
    }

    $projects = et_divi_get_projects( $args );
    $categories_included = array();

    Any thoughts would be greatly appreciated. Thanks again.

    Kai

    May 29, 2015

    • Oops I meant original code in 2.3.1 functions.php πŸ™‚

      Also on the actual line with the error is this line:
      if( 'on' === $show_pagination ) {

      Kai

      May 29, 2015

      • OMG! This always happens to me. As soon as I post a question for something I can’t figure out I then figure it out. I simply replaced this code in adjusted 2.3.2 functions.php
        $args = array();
        if( 'on' === $show_pagination ) {
        $args['nopaging'] = true;
        } else {
        $args['posts_per_page'] = (int) $posts_number;
        }

        With this from the original 2.3.1 functions.php
        $args = array();
        if ( is_numeric( $posts_number ) && $posts_number > 0 ) {
        $args['posts_per_page'] = $posts_number;
        } else {
        $args['nopaging'] = true;
        }

        Just in case anyone else has the problem. πŸ™‚

        Kai

        May 29, 2015

    • Hi Kai, glad you were able to get it to work on 2.3.1. ET was updating Divi so fast I ended up skipping that version. And thank you for posting your fix for others

      Brad (admin)

      June 5, 2015

  11. I am getting:
    Notice: Undefined variable: show_pagination in /usr/home/bethnicol/public_html/bethnicol.com/wp-content/themes/famvindivi/functions.php on line 4371

    I tried using the functions.php in a child, but there were so many functions that are not pluggable that I resorted to updating the Divi 2.3.2 core files. Still get the problem. I have no project categories because I am trying this so that I can use post categories.

    Ideas?

    beth

    June 9, 2015

  12. Brad,

    Waiting for your update for Divi 2.4 πŸ™‚

    Edo

    June 18, 2015

    • Me too! Can’t wait for it! Thank you so much for doing this! You should submit it to elegant themes – it seems that everyone wants this functionality but they aren’t giving it, grr. So thank you for making it possible!

      Kimmy

      June 26, 2015

  13. hey there!

    How can I display excerpts of posts?

    luke

    June 19, 2015

  14. Hi Brad,

    Wish i had seen your post before updating to divi 2.4. Hope a 2.4 compatible code is in the making?

    πŸ™‚

    eurion

    June 28, 2015

  15. Hello everyone. This tweak is by far the most complicated of any of my tweaks. Due to the nature of having to replace files to get this to work, it is becoming a chore trying to keep up with the Divi updates. Now that Divi 2.4 is out and after looking at the code, it no longer makes sense to continue supporting this tweak in its current form. The good news is that I plan to convert this tweak into a plugin. It just makes more sense to create something that will not break with every Divi update. My time is limited but I hope to have this finished soon. Thank you for all of the kind words and support and stay tuned for the plugin! Be sure to sign up for the newsletter for updates on the plugin.

    Brad (admin)

    June 28, 2015

    • Thanks Brad. We patiently await the coming of the plugin.

      eurion

      June 30, 2015

  16. I’m interested in the plugin…following πŸ™‚

    MELINDA ORR

    July 29, 2015

  17. Hi Brad,

    I just got a mail wrt the posts in portfolio as a plugin. Thanks for the great work. Will try it out.

    Eazy

    August 5, 2015

  18. Hello everyone. The beta version of the plugin is finished and can be downloaded here: http://www.diviplugins.com/plugins/portfolio-layout-posts/. Keep in mind that it does NOT currently work with Filterable Layouts AND does not work like the tweak above. It uses shortcodes. I’m hoping to change both of those in a future release. Documentation and Demo can be found at the bottom of the download page. Thanks and please give feedback if you run into any issues!

    Brad (admin)

    August 6, 2015

  19. Thanks

    javier

    August 7, 2015

  20. When do you think you can include Filtered Portfolio?

    Thanks in adanvce

    ALAIN MINNOY

    August 20, 2015

    • Hoping to tackle this over the next week. Will update as soon as finished. Thanks.

      Brad (admin)

      August 21, 2015

      • Ok, please let us know as it is exactly what we need and we are just populating our new website. I would love to work only with regular posts as I don’t see any reason why they created Projects. I need my blogs to displays all posts and I need the filterable portfolio on posts.

        We will gladly support your plugin πŸ™‚ Thanks in advance

        ALAIN MINNOY

        September 2, 2015

      • Brad, great plugin. Do you have an update on adding the filterable portfolio for posts? Thanks!

        Benjamin

        September 18, 2015

      • Very close! Sorry for the delay. Got hammered at work and then came down with the flu. I have filterable posts working, just need to get pagination working properly. I’ll update as soon as it’s ready. Thanks!

        Brad (admin)

        September 21, 2015

        • Great to hear! I’ll be praying for your continued health and a clear head with which to work!

          Benjamin

          September 21, 2015

      • We just bought your pro plugin πŸ™‚

        You just saved us hours of development.

        THANK YOU !

        ALAIN MINNOY

        October 2, 2015

  21. Hello, just one question

    I bought the pro version and designed a Filterable blog.

    I have let’s say Category BOOKS and Subcategory COMICS
    My Blog post belongs to both the cat and the subcat.

    In the FP Blog, I select only COMICS, but BOOKS appears too?

    Could you please fix that?

    Thank you πŸ™‚

    Your plugin is amazing thank you so much

    ALAIN MINNOY

    October 3, 2015

    • Thank you for bringing that to my attention Alain. Apparently WP automatically pulls sub categories in the loop. I haven’t dug into a solution yet but offhand I’m thinking the easiest,most efficient way would be to give an option to not include any subcategories. Would that work for your needs or would you want more granular control? Including or excluding each subcategory individually?

      Brad (admin)

      October 3, 2015

    • This is now fixed. Please log in with the account you signed up with and download the latest version. I have also added the ability to link to custom URLs using custom fields and also added the option to add the post excerpt

      Brad (admin)

      October 28, 2015

  22. The plugin does not support WPML and it doesnt work with the Russian language side of the website i am building. Is there a way to fix this? URGENT PLEASE!!!

    Sofia

    August 16, 2016

  23. Hi, good call making it as a plugin! I’m wondering if you would ever make it work for pages too/instead?

    Ella

    September 29, 2016

  24. Hi Brad, I have version 1.9 of Divi (I know, pretty old) will your manual tweak work with this version, or will it be worthwhile to upgrade? I really want a portfolio for my posts and had begun to move posts over to projects but it takes SO LONG. I also noticed projects don’t show up in the blog feed which is a bit of an issue. Many thanks in advance!

    Danielle

    October 26, 2017

Post a Reply

Your email address will not be published. Required fields are marked *