-
AuthorPosts
-
April 20, 2015 at 3:22 pm #431331
Hi Josue!
A few months ago you solved a problem concerning some portfolio pages on https://kriesi.at/support/topic/icon-fonts-dont-appear/
Now I have to built a festival archive (1967 – 2014) with 3.600 portfolio items. In order to make it searchable and filterable, I’m using the Search & Filter Plugin. The plugin displays the search-results
(1) as an archive-page or
(2) using a shortcode in combination with a customized template.
(1) I’m using ENFOLD ‘taxonomy-portfolio_entries.php’ and the results are well displayed on a new page: http://hofer-filmtage.com/testarchiv-a/
(2) I’m using ENFOLD ‘taxonomy-portfolio_entries.php’ without get_header(); and get_footer(); as customized template. The results are displayed on the same page in a new container, but doesn’t work well. It seems like it’s building a grid, but cannot load the portfolio entries: http://hofer-filmtage.com/testarchiv-b/
It would be very helpful, if you would have a look on that.
Do you have an idea?
Best regards
BerndApril 21, 2015 at 11:53 am #431899April 22, 2015 at 9:27 am #432643Hey Josue!
Thanks for having a look.
My customized template on the base of taxonomy-portfolio_entries.php: http://pastebin.com/7bzAX36b
The template, which comes with the plugin: http://pastebin.com/0RMTTc2q
Best regards
BerndApril 22, 2015 at 6:45 pm #433049Hi,
The grid is being built by this code:
<?php $grid = new avia_post_grid(array( 'linking' => 'ajax', 'columns' => '3', 'contents' => 'excerpt', 'sort' => 'no', 'paginate' => 'yes', 'set_breadcrumb' => false, )); $grid->use_global_query(); echo $grid->html(); ?>
What’s the layout you want to achieve?
Cheers!
JosueApril 22, 2015 at 7:56 pm #433075Hi Josue!
Thanks, but the result is as similar as before: http://hofer-filmtage.com/testarchiv-b/
The layout I want to achieve should look like the portfolio grid on http://hofer-filmtage.com/testarchiv-a/
If you want, I would create a WP account, so you may check or test the template in the editor.
Thanks and best regards
BerndApril 23, 2015 at 5:31 am #433231I see, yes, please hand me a WP administrator account via private reply.
Best regards,
JosueApril 23, 2015 at 9:07 am #433308This reply has been marked as private.April 25, 2015 at 5:29 am #434574Hi Bernd!
It doesn’t work because you’re assigning the grid query to the global query ($wp_query), which in this case is the page being shown. What you need to do, is use the $query variable (provided by the plugin).
However, as the $entries variable is protected inside the grid class you’d need to create a public function similar to
use_global_query
, specifically for this use, something like this (config-templatebuilder/avia-shortcodes/portfolio.php):public function use_search_and_filter_query($query) { $this->entries = $query; }
And then in 7033.php:
<?php $grid = new avia_post_grid(array( 'linking' => 'ajax', 'columns' => '3', 'contents' => 'excerpt', 'sort' => 'no', 'paginate' => 'yes', 'set_breadcrumb' => false, )); $grid->use_search_and_filter_query($query); echo $grid->html(); ?>
I’ve done this modification right now and it seems to work, check it.
Regards,
JosueApril 25, 2015 at 8:34 pm #434741Hi Josue!
Thanks so much – that’s really the perfect solution.
We are totally excited. Everything works fine: searching, filtering, pagination, WPML …
Great work!
BerndApril 25, 2015 at 8:43 pm #434743Hey Bernd!
You’re welcome, make sure to backup all modified files so you can restore them in case of updating the theme.
Regards,
JosueApril 25, 2015 at 9:22 pm #434746Hey Josue!
Yes, o.k., I think it’s only concerning the ‘search-filter’-folder with my template and the code you added in the file config-templatebuilder/avia-shortcodes/portfolio.php.
Cheers!
BerndApril 26, 2015 at 9:50 pm #434924Hi,
Correct, alternatively you could use a child theme and have these mods stored there instead on the parent theme.
Also check:
http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/Cheers!
JosueAugust 17, 2018 at 9:25 am #998345Hi Josue,
I have exactly the same problem and was happy to find your solution! But your code snippet for the function.php doesn´t work for me:public function use_search_and_filter_query($query) { $this->entries = $query; }
I already use a child theme. Is this the problem? Can you help?
August 17, 2018 at 10:22 am #998356Hi there,
you’ll probably find the solution in REPLY # 434574 – I’ve added Josue’s snippet at line 968 in portfolio.php.
Best regardsAugust 17, 2018 at 11:09 am #998364… yes – of course: I tried to use Josue’s solution! Problem is the code snippet for the function as mentioned in my post before #998345
August 19, 2018 at 11:11 am #998874Hi,
The code Josue provided won’t work “out of the box” and is also not intended to be used in functions.php. It’s just a starting point for a custom php class. If you don’t know how to implement and use the code please hire a developer who can implement it for you.
Best regards,
DudeAugust 20, 2018 at 9:09 am #999228… OK. But the only information I need is:
On which line (in “config-templatebuilder/avia-shortcodes/portfolio.php”) should I paste Josue’s code snippet?Just this little Information will help. Can you please tell me the number of the line?
August 20, 2018 at 9:40 am #999258Hi,
You can add it anywhere inside the “class avia_sc_portfolio”, i.e. below the “function shortcode_handler” which ends on line 431
Best regards,
DudeAugust 20, 2018 at 10:13 am #999274… thanks Dude! But your suggestion causes a syntax error. This is the portfolio.php with code snippet on line 427:
https://pastebin.com/UJ2876g6August 20, 2018 at 6:17 pm #999526Hi,
It seems like the line numbers are different. Based on the file here https://pastebin.com/UJ2876g6 you need to move the code to line 424. So make sure the curly bracket ( } ) on line 424 is AFTER this codepublic function use_search_and_filter_query($query) { $this->entries = $query; }
Best regards,
DudeAugust 21, 2018 at 7:41 am #999686…. thanks again for your support. I have already placed the code before the curly bracket- see https://pastebin.com/VxhNU7eu
But syntax error still exist.August 21, 2018 at 7:53 am #999694Hi,
I modified the code for you: https://pastebin.com/4we4UCnY – it was a character encoding issue with the > character. I also had to move the code one line up.
Best regards,
DudeAugust 21, 2018 at 9:35 am #999705… great – the syntax error is gone – thanks!
But also I try to do it the same way as Bernd (using ENFOLD ‘taxonomy-portfolio_entries.php’ without get_header(); and get_footer(); as customized template) it will not working.
What I´ve done:
1) Modify the ENFOLD portfolio.php like here: https://pastebin.com/4we4UCnY
2) Modify SEARCH&FILTER results.php like here: https://pastebin.com/ZbMLs9Xz
… do you have an idea what`s wrong?All the mods are in my child-theme:
CHILD/shortcodes/portfolio/portfolio.php
CHILD/search-filter/results.phpIn case you will have a closer look, you will find login credentials in private content – thanks in advance!
August 24, 2018 at 7:43 am #1001052… I don´t want to get impatient – but since 3 days I´m waiting for your answer. So please just let me know:
Do you want to canceling your support?
Or would you like help me further on?August 24, 2018 at 2:56 pm #1001263Hi there! We’ve built the page with Enfold Avia Layout Builder and S&F Shortcode. Please let me know, if you want to achieve exactly the same result. After that I’ll try to remember …
Best regards
BerndAugust 24, 2018 at 3:53 pm #1001282Hey Bernd, thanks for vour willingness to help! And yes, his is exactly what I will do! The results of S&F should look like portfolio entries.
What I´ve done:
1) Modify the ENFOLD portfolio.php like here: https://pastebin.com/4we4UCnY
2) Modify SEARCH&FILTER results.php like here: https://pastebin.com/ZbMLs9Xz
… but with this mods I get no results at all (without this mods results will displayed). Do you have an idea what`s wrong?August 24, 2018 at 7:27 pm #1001359Hi frankeee, here our steps – as far as I can remember – but NOT using a child-theme:
1) ADD NEW SEARCH FORM in S&F with “Results Method = Using a shortcode”. For example, the searchandfilter id is “253”.
2) Add Joshua’s code at the end of portfolio.php//function that allows to set the query to an existing post query. usually only needed on pages that already did a query for the entries, like taxonomy archive pages. //Shortcode uses the query_entries function above public function use_global_query() { global $wp_query; $this->entries = $wp_query; } /* Added by Josue */ public function use_search_and_filter_query($query) { $this->entries = $query; } /* End Added by Josue */ } }
3) Create a S&F results php file, named with the S&F shortcode id, for example 253.php in the folder “search-filter”, put this folder in the enfold-folder:
<?php $grid = new avia_post_grid(array( 'linking' => 'ajax', 'columns' => '3', 'contents' => 'excerpt', 'sort' => 'no', 'paginate' => 'no', 'set_breadcrumb' => false, )); $grid->use_search_and_filter_query($query); echo $grid->html(); ?>
4) Put the S&F shortcodes for search fields and results in the text editor or in a customized widget area somewhere on the page:
[searchandfilter id=”253″]
[searchandfilter id=”253″ show=”results”]
Good luck!
BerndAugust 27, 2018 at 12:06 pm #1002235Hey Bernd, thanks a lot or your detailed instructions !!!
Unfortunately, I was not lucky. Although I renamed results.php into my-S&F-ID.php. Nevertheless the mods should also run in a child, I´ve done it directly in enfold – like you do. Anyway can someone of the enfold support team tell me if a public function will work in a child-theme?
A public function like this:
1) Own puplic function on line 424 of portfolio.php: https://pastebin.com/4we4UCnY
2) Put the modified portfolio.php in CHILD-THEME/shortcodes/portfolio/portfolio.php
3) Add this filter to the function.php:function reiselaender_func( $atts ){ return get_field( 'reiselaender'); } add_shortcode( 'reiselaender', 'reiselaender_func' );
If this puplic function works – why does the following code snippet not showing any results?
<?php $grid = new avia_post_grid(array( 'linking' => 'ajax', 'columns' => '3', 'contents' => 'excerpt', 'sort' => 'no', 'paginate' => 'yes', 'set_breadcrumb' => false, )); $grid->use_search_and_filter_query($query); echo $grid->html(); ?>
Do I have to put the S&F Search-ID anywhere? Filename with S&F Search-ID, like Bernd did, is not working for me.
If someone will have a closer look, you will find login credentials in private content.August 27, 2018 at 7:46 pm #1002428Hi frankeee, have you already tried to add Josue’s code AT THE END of portfolio.php, like in our solution?
August 28, 2018 at 7:56 am #1002582Guten Morgen Bernd, yes but this will cause the error in portfolio.php:
Cannot redeclare avia_post_grid::use_global_query() in /home/www/dev……/shortcodes/portfolio/portfolio.php on line 959Otherwise Dude´s suggestion (see #999694) will cause the error in results.php:
Call to undefined method avia_post_grid::use_search_and_filter_query() in /home/www/dev/search-filter/results.php on line 26Even if I rename the results.php with my S&F-ID.php – I get the same error.
-
AuthorPosts
- The topic ‘Portfolio entries’ is closed to new replies.