Tagged: V3
- This topic has 19 replies, 2 voices, and was last updated 5 years, 9 months ago by Anonymous.
-
Anonymous(Private) March 22, 2019 at 6:34 am #205948
Hello,
I need to show a shortcode in search results, this shortcode is in an excerpt. It’s an audio player. Now it’s displaying the only text of shortcode.How to fix it?
PS Also where can I find information about creating custom result page? (i am not savvy with web development, PHP codes for title, excerpt etc will be great)
Anonymous(Private) March 22, 2019 at 6:57 am #205949Also, is it realistic to create a default value for taxonomies?
For example, I have these checkboxes:( ) Checkbox 1
( ) Checkbox 2
( ) Checkbox 3
( ) Checkbox 4Can one of them be ticked by default?
(*) Checkbox 1
( ) Checkbox 2
( ) Checkbox 3
( ) Checkbox 4Trevor(Private) March 22, 2019 at 7:29 am #205953By default, WordPress does not execute shortcodes in excerpts. What Display Results Method are you using in your form?
At this time, there is no UI option to pre-select a default value in the form, sorry. It is something we are working on for V3 (still some months away).
Trevor(Private) March 22, 2019 at 8:17 am #205961As you are using our shortcode method, the guide for customization is here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
You need to find this line:
<p><br /><?php the_excerpt(); ?></p>
and replace it with something like:
<p><?php echo get_the_content(); ?></p>
You can edit pretty much anything in this file, but make small changes and test.
Anonymous(Private) March 22, 2019 at 8:45 am #205967I will edit template thanks.
But this not quite what I need, now it displays all page content under the title.
By default, it’s showing the right data in an excerpt, but doesn’t execute shortcode in it.
Screenshot:
https://drive.google.com/open?id=1s_uqhkxnolGnRbMRXmivjn0BkyeIClbYIn my post type (Portfolio) I have a custom field “excerpt” there is one specific shortcode that I need to show on my search result.
Also, it will be great to use custom field data to show in my result page, how to include it?
Trevor(Private) March 22, 2019 at 8:51 am #205969The execution of shortcodes in the excerpt is down to your theme and WordPress. If you are using a child theme (you should be), then this might help:
http://miftyisbored.com/wordpress-executing-shortcode-inside-the_excerpt/
Are you using ACF to make the custom fields, or something else?
Anonymous(Private) March 22, 2019 at 9:07 am #205971http://miftyisbored.com/wordpress-executing-shortcode-inside-the_excerpt/
It helped! Thanks.
Are you using ACF to make the custom fields, or something else?
I am using ACF.
Anonymous(Private) March 22, 2019 at 9:28 am #205975update: it helped but not fully.
It loads shortcode correctly only on page 1, next page audio loads with default browser player.
You can check it yourself: https://tunestogo.net/portfolio-test/Trevor(Private) March 22, 2019 at 9:44 am #205978Is the page loading using Ajax? If so, that will be the issue, as the player you are using needs reinitialising after an Ajax load. What player are you using?
As to ACF fields. Let us assume it is a single value field use key is
my_custom_field
and the prefix required isMy Custom Field Value
, then the PHP is this:<?php if( get_field('my_custom_field') ):?> <p>My Custom Field Value: <?php the_field('cial_secteur'); ?></p> <?php endif; ?>
-
AuthorPosts