Like our free content? Then you'll love our exclusive Club!
Divi Academy Membership gives you exclusive access to over 110 resources, including child themes, layouts, cheatsheets, tutorials, live training and member perks. And new content is added EVERY Monday!
Updated 22.04.18: Provided more efficient jQuery code.
There are a fair few solutions floating around showing how to change the order of the Divi filterable portfolio tabs/filters, these generally show how to change the order from ascending to descending and require some PHP.
The tabs are shown in alphabetical order by default, but what if you want them in a completely custom order, neither ascending or descending? Fear not, we can do this with some creative thinking and a little jQuery. (I am sure there is a PHP way to do this too but that is not my thing )
So let’s get cooking!
Cooking time
Less than 15 minutes!
Preparation
For your prep just make sure you have some projects created and all the ones you want to display are in a category.
Then navigate to Projects > Categories and we are going to prefix our categories so we can order them.
Hover over the category you want displayed as the first filter and click the Quick Edit menu item that appears. Change the title (not the slug) by prefixing it with a ‘1‘ like this:
Then click Update Category.
Next go ahead and repeat the process with all your other categories, incrementing the number each time. When you refresh the page your categories will list in ascending order like this:
That’s our prep done.
Method
Now let’s create our module:
Anywhere you like on your page, add a new filterable portfolio module. Select the categories you just set from the list in the Content tab, then go ahead and adjust any other settings in this tab you want.
Next, click the Design tab and set the Layout to Grid (I am assuming you want a grid layout here ). Again, adjust any of the other setting you like.
And finally, click the Advanced tab and give your module a CSS class of ds-portfolio-custom-order, then Save & Exit.
Now if you preview your page it will look something like this.
You will see your tabs are in the order you have set, but it’s not ideal having that number in front of the tabs or the categories. So let’s fix that.
We are going to add a little jQuery. Here’s what we are doing:
The filterable portfolio uses ajax for its pagination, so we wrap our code in a bind function to make sure it still works when pagination in on.
Then we target the categories in the tabs, the post meta of our module and also the post meta on the single project pages and tell the browser to replace the number in each category with nothing, basically removing the number from the page.
<script>
//Custom portfolio tab order by Divi Soup
(function ($) {
$(document).ready(function () {
$(document).bind('ready ajaxComplete', function () {
$(".ds-portfolio-custom-order .et_pb_portfolio_filters li, .ds-portfolio-custom-order .post-meta, .single-project .et_project_categories").html(function () {
return $(this).html().replace(/[0-9]+/, '');
});
});
});
})(jQuery);
</script>
So copy the code above and paste into Divi > Theme Options > Integration > Add code to the < head > of your blog. Be sure to keep the script tags too or it won’t work.
Now when you view your portfolio and projects you will see all the numbers have been removed but the order you chose remains
And that’s it! You can use this method in loads of other ways too once you understand how it works.
If you found this helpful please leave a comment and subscribe to my newsletter for all my latest Divi related content.
Michelle X
Hi! Thanks for this receipt! It’s very usefull! But you must update it removing the br from each line…
Cheers!
Hi, I was able to remove the numbers for the Tab Headings.
But some my projects have multiple categories selected for them. The number from the first category listed in the post meta has been removed, but the other categories listed for that project have the numbers showing.
Can you please advise how I can remove the numbers from the additional post meta categories?
Thanks,
I haven’t been able to get this to work on my site. The numbers remain. Thanks!
We are going to need a live link so see what the issue might be
Hi not getting this to work still. The number is still in front of the category name….
http://www.franchisesound.com/music
Can only see a coming soon page, will need a live link please
Hi, I heve problem with my portfolio. I need create porfolio (firtabled portfolio divi) with tabs, and what is very imoportant here that i must be with lightbox. Now my photo just open in next window.
So: tabs/firtabled portfolio where we can bigger images open in “pop-up” window. How do that?
You will want to use a plugin for this or you can use a shortcode to place gallery library layouts into a tab module
Love this since I need to force an order but I can’t get rid of the numbers and I’m sure I’m doing everything according to your instructions. Any chance you can look at this?
Thanks in advance.
Yes but going to need a live link with the code applied please
Hi
This is the page: https://fitwithgilad.com/before-and-after-sucess-stories/
Try using this below and ensure you are placing it in the top box of the integration tab (try placing it at the top, instead of bottom since there are a few scripts you have going in the head):
I’m sorry…. Using what below? It is the first script in the “Add code to the of your blog” box under integration.
It’s getting filtered out, but try removing the
from each line and ensure you are using the most recent version of Divi. If you’re not, you’ll need to remove anything that is commented out as well.
I did this and still not working.
(function ($) {
$(document).ready(function () {
$(document).bind(‘ready ajaxComplete’, function () {
$(“.ds-portfolio-custom-order .et_pb_portfolio_filters li, .ds-portfolio-custom-order .post-meta, .single-project .et_project_categories”).html(function () {
return $(this).html().replace(/[0-9]+/, ”);
});
});
});
})(jQuery);
You may need to get a developer to assist since we cannot duplicate the error and it seems isolated to your site. Sorry
Nevermind. Found a custom taxonomy plugin to re-order.
link?
I removed all of the
code from the script but it is not removing the #s.
Please take a look and advise, thanks!
Hello, I think i did everything as explain, but it doesn´t work at all. Can you help me? the site is http://www.sinprisa.cl/traumatologos
Sorry but that is a dead link
Having same issue, numbers are not being removed….
I”m having the same issue – the script doesn’t hide the numbers…
HI, this is great and it will help me, but I want to know is if I can sort the projects that are under each category, since I have many projects under each category. ie:
http://pabloholcer.com/works/
thx for the help.
You will need to look at a PHP solution for that, they are sorted by date by default but there are snippets around to change that
To anyone having trouble getting this to work:
Delete all of the
from the code after pasting into the Head.
Thanks for the great tip!
Hi, it’s not working for me!
All of the what?
Hello, sorry I can’t see, ‘…all of the…[what] from the code’ ?
I’m have the same issue where the numbers still appear.
Thanks in advance.
Keith
Delete all of the what from the code?
Hi, This is exactly what I’m looking for, but when I follow these steps, I can’t get it to remove the number in front of the category name. I double checked that everything is in the right spot, and I went through the steps a couple of times to make sure I didn’t miss anything. Do you have any suggestions for troubleshooting?
Thank you
There definitely shouldn’t be a number visible (http://divisoup.com/custom-tab-order-in-the-divi-filterable-portfolio-module-demo/). Can you share a link to the page this is happening on so we can take a look?
Melissa, did you ever figure this out? I can’t get the numbers to not display either.
Thank you!
Remove all forms of or
from the script. Should look like this.
(function ($) {
$(document).ready(function () {
$(document).bind(‘ready ajaxComplete’, function () {
$(“.ds-portfolio-custom-order .et_pb_portfolio_filters li, .ds-portfolio-custom-order .post-meta, .single-project .et_project_categories”).html(function () {
return $(this).html().replace(/[0-9]+/, ”);
});
});
});
})(jQuery);
Thanks this worked!
Not sure why those br page breaks are there and why this site keeps filtering them in the comments lol.