This topic has 24 replies, 2 voices, and was last updated 7 years, 3 months ago ago by Laranz
Hello, in a page like this https://www.8theme.com/demo/woopress/fullwidth/portfolio/?col=4
1.
When the page is loaded the default bottom is “Show All”. Could I obtain that the default bottom becomes the first category? In this example “Aenan” should be appear selected when I enter in this page portfolio.
2.
In this example the post entitled “PHASELLUS ERAT MI, ALIQUAM NEW” has two categories associated to him, in this case “AENEAN” and “NULLAM”.
And in fact above the title (in the “ByLine”, like you call it in the options of the theme) appears “AENEAN, NULLAM”.
Well, can I obtain that the first category (the same one of the question of the first point) is not visible in the ByLine? Therefore even it is present in the botton, I don’t see it below the picture and above the title.
Hi,
1. No, by default it loads all the portfolio items in the portfolio page, we can’t able to filter that on page load.
2. You can use this Custom CSS in Theme Options,
.portfolio-item .posted-in a:nth-child(n+2) { display: none; }
it will hide the second category.
Let us know,
Thanks,
laranz.
Hello Laranz, thanks for your answers.
1. Now I understand how it works. Well, at this point there is a way to say: once you’ve loaded the page, show this category right away?
For the user the result should be the same.
2. This script doesn’t work. See the result in these two screenshots (in pvt the links). The first picture shows how it should be, but without the category showed with the arrows (my second category). The second pic shows the result with the script, as you can see all other categories disappear after the first and strange periods appear, always different.
Moreover, in this category the first category is not chosen in the right way. May we can identificate it with an ID or with its own name or slug?
Any news?
Hi,
1. No we can’t change that after loading too, you need to click the filter to filter through.
2. You want to display only one category right? Or can you explain a little bit more about what you want to change, so that I can alter the snippet according to the needs.
Let us know,
Thanks,
laranz.
1. There isn’t a script that could simulate the user click? For example, a JavaScript that executes immediately after the page has been loaded, something like <body onload="myFunction()">
2. As explained before, I would like that a precise category (see in pvt content an example) is not shown in the ByLine description. But must be shown in his filter button.
Hi,
1. It is possible, but it is out of the support of the scope, you can call our customization service if you need any help: https://www.8theme.com/our-installation-service/
2. Well, this need editing theme file, if you’re okay with you it, continue.
open up /wp-content/themes/woopress/framework/portfolio.php and in that you will see a function at 476, replace that function with this one,
function print_item_cats($id) {
//Returns Array of Term Names for "categories"
$term_list = wp_get_post_terms($id, 'portfolio_category');
$term_list = wp_list_filter( $term_list, array( 'slug'=>'in-evidenza' ),'NOT' );
$_i = 0;
foreach ($term_list as $value) {
$_i++;
echo '<a href="'.get_term_link($value).'">';
echo $value->name;
echo '</a>';
if($_i != count($term_list))
echo ', ';
}
}
I add one extra line,
$term_list = wp_list_filter( $term_list, array( 'slug'=>'in-evidenza' ),'NOT' );
or you can simply create a separate function with a unique name in your functions.php in child theme, and call that in content-portfolio.php in your child theme in line #54.
Let us know,
Thanks,
laranz.,
Hi Laranz,
1. Ok, I’ll ask a quote to your customization service. I thought it was a simple thing.
2. I changed the function in portfolio.php with your script, but I don’t see any result. Check yourself too. Do I need to insert something else maybe?
Hi,
1. Thanks.
2. It seems you edited the content-portfolio.php so only the code didn’t take effects, it seems.. Now, I edited the content-portfolio.php and also added the function in to the child, so that the change is update proof. 🙂
function child_print_item_cats($id) {
//Returns Array of Term Names for "categories"
$term_list = wp_get_post_terms($id, 'portfolio_category');
$term_list = wp_list_filter( $term_list, array( 'term_id'=> '71' ), 'NOT' );
$_i = 0;
foreach ($term_list as $value) {
$_i++;
echo '<a href="'.get_term_link($value).'">';
echo $value->name;
echo '</a>';
if($_i != count($term_list))
echo ', ';
}
}
Now the in-evidenza category won’t show in the description.
Let us know,
Thanks,
laranz.,
Hi Laranz,
in portfolio.php you insert the line ‘$term_list = wp_list_filter( $term_list, array( 'slug'=>'in-evidenza' )
but the slug was0-in-evidenza
, not in-evidenza
(there is “0-“, needful for my custom order of the buttons and of the ByLine).
In any case it works, but only in Italian, not in English or Chinese.
I see that in function.php you inserted this line:
$term_list = wp_list_filter( $term_list, array( 'term_id'=> '71' ), 'NOT' );
I tried to add also ID 72 (En) and 73 (Cn)
both in this way
$term_list = wp_list_filter( $term_list, array( 'term_id'=> '71,72,73' ), 'NOT' );
and in this too
$term_list = wp_list_filter( $term_list, array( 'term_id'=> '71','72','73' ), 'NOT' );
but it doesn’t work.
How can I make the script working in every language?
Thanks to have put it in the child too, but if I can keep this in one place only is better. Portfolio.php cannot be inserted in the child, it doesn’t work… therefore I need to backup it before the next update in any case. In fact I’ve a lot of other customizations inside this file, therefore it’s not a problem if you keep all things there.
I’ve not understood where the last script is placed: porfolio.php, content-portfolio.php or function.php? Or in all three?
IMPORTANT:
I lost some of the previous customizations.
1. after your last change the ByLine is no more ordered by slug (as it was before, thanks to the script of your colleagues)
2. after your last change in the mobile version I don’t have anymore two columns (as it was before, thanks to the script of your colleagues)
3. now in the desktop version the space between columns are wrong. I lost entire weeks of customizations.
4. there other some small errors around now…
Why? By chance have you removed some previous custom instruction? Can you restore the previous and make only the needful to remove IN EVIDENZA in the ByLine in every language?
Hi,
If you want to exclude multiple categories, then remove these lines,
$term_list = wp_get_post_terms($id, 'portfolio_category');
$term_list = wp_list_filter( $term_list, array( 'term_id'=> '71' ), 'NOT' );
and add this,
$term_list = wp_get_post_terms( $id, 'portfolio_category', array( 'exclude'=> array( '68', '72', '80' ) ));
where 68, 72, 80 are the category ID respectively.
Let us know,
Thanks,
laranz.,
Thanks, now I try.
Please note that before I edited the previous message. Maybe you have replied before reading all things. Please read again because there are a lot of things that now dont work.
Hi,
I have a copy of your previous content-portfolio.php as content-portfolio-old.php you can use the old file if you want, and make sure you change the things I did in the new file, it will preserve what you already edited.
Let us know,
Thanks,
laranz.,
I also have a backup of portfolio.php, content-portfolio.php and function.php (namely the 3 files you have modified now).
I would like to have the last modifications (hidden In-Evidenza) plus all other previous change. Is it possible?
Hi Laranz, if you confirm to me that the last modification is only in function.php (as I’ve seen from the last correction, that works) I restore the old portfolio.php and content-portfolio.php and after try to modify again function.php comparing the old and the new versions side by side
Hi,
Here is what I did.
1. Created the function child_print_item_cats in the functions.php
2. Rename your content-portfolio.php to content-portfolio-old.php
3. Copy the theme’s content-portfolio.php and create a new file with the same name in the child theme.
4. In line #54 of that file, change the function reference print_item_cats to child_print_item_cats so that it will point to the new function.
Let us know,
Thanks,
laranz.,
Thanks for the explanations. Now I try to transfer these modifications to the old files.
I think the problems are due to the fact that function.php and content-portfolio.php were already in the child and were enough with heavy modifications inside, that with your copy maybe gone lost.
The modifications made on portfolio.php at the beginning can go lost at this point?
Hi,
I don’t think so anything get lost or not. You can get the content-portfolio.php from content-portfolio-old.php. I didn’t edit any portfolio.php
Let us know,
Thanks,
laranz.,
Ok, thanks. Regarding the portofolio.php, at the beginning to told me to modify it
2. Well, this need editing theme file, if you’re okay with you it, continue.
open up /wp-content/themes/woopress/framework/portfolio.php and in that you will see a function at 476, replace that function with this one,
But at this point I dismiss it, if you say that it is not important.
I’ll do these things and let you know if always is solved… I tell you later
Hi,
Leave the portfolio.php file, it is from the parent theme, so if we do any edits it will be discarded with the update. Now, what we did with the child theme ( functions.php & content-portfolio.php ) will do the trick. 🙂
Let us know,
Thanks,
laranz.,
As explained before. More than ten customizations suggested by your colleagues work only in the portfolio.php
And portflolio.php works only in the main theme, if copied in the child (in its framework empty folder) doesn’t work, as confirmed by your colleagues several times too.
Therefore I need to keep my heavy-modified portflolio.php in the main theme and backup it before any update of the theme. Unless your team sooner or later find a way to make it working in the child too.
Hi,
In that case you can edit that. 🙂
Let us know if you have any other questions,
Thanks,
laranz.,
All solved, thank very much for your help!
Hi,
Glad we helped. 🙂
Let us know If you have any other questions.
If you’re happy with our service, don’t forget to rate us 5* in themeforest. 🙂
Thanks,
laranz.,
The issue related to '‘Portolio Filters (Bottons and ByLine)’' has been successfully resolved, and the topic is now closed for further responses