Portolio Filters (Bottons and ByLine) - by designerobot

This topic has 24 replies, 2 voices, and was last updated 6 years, 7 months ago ago by Laranz

  • Avatar: designerobot
    designerobot
    Participant
    August 4, 2017 at 17:44

    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.

    23 Answers
    Avatar: laranz
    Laranz
    Participant
    August 7, 2017 at 06:02

    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.

    Avatar: designerobot
    designerobot
    Participant
    August 7, 2017 at 13:28

    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?

    Please, contact administrator
    for this information.
    Avatar: designerobot
    designerobot
    Participant
    August 8, 2017 at 01:29

    Any news?

    Avatar: laranz
    Laranz
    Participant
    August 8, 2017 at 23:04

    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.

    Avatar: designerobot
    designerobot
    Participant
    August 9, 2017 at 01:03

    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.

    Please, contact administrator
    for this information.
    Avatar: laranz
    Laranz
    Participant
    August 9, 2017 at 01:54

    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.,

    Avatar: designerobot
    designerobot
    Participant
    August 9, 2017 at 02:25

    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?

    Avatar: laranz
    Laranz
    Participant
    August 9, 2017 at 04:10

    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.,

    Avatar: designerobot
    designerobot
    Participant
    August 9, 2017 at 05:19

    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?

    Avatar: laranz
    Laranz
    Participant
    August 9, 2017 at 05:50

    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.,

    Avatar: designerobot
    designerobot
    Participant
    August 9, 2017 at 05:53

    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.

    Avatar: laranz
    Laranz
    Participant
    August 9, 2017 at 05:56

    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.,

    Avatar: designerobot
    designerobot
    Participant
    August 9, 2017 at 06:04

    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?

    Avatar: designerobot
    designerobot
    Participant
    August 9, 2017 at 06:18

    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

    Avatar: laranz
    Laranz
    Participant
    August 9, 2017 at 06:31

    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.,

    Avatar: designerobot
    designerobot
    Participant
    August 9, 2017 at 06:48

    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?

    Avatar: laranz
    Laranz
    Participant
    August 9, 2017 at 06:52

    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.,

    Avatar: designerobot
    designerobot
    Participant
    August 9, 2017 at 06:59

    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

    Avatar: laranz
    Laranz
    Participant
    August 9, 2017 at 07:02

    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.,

  • 1 2
    Viewing 20 results - 1 through 20 (of 24 total)

The issue related to '‘Portolio Filters (Bottons and ByLine)’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.