• Resolved karenyoung1

    (@karenyoung1)


    I have added the Compact WP Audio Player plugin to this site https://stjohnshallgallery.barmouthwales.uk/ and it is working well on individual posts and on the home page that has multiple posts in a masonry layout. But when posts are presented as results from a search, the page should have the same layout as the home page, but instead the posts with the code inserted just show the code without putting in the play bar. I am unsure if this is an issue with the theme or the plugin.

    Here is an example search https://stjohnshallgallery.barmouthwales.uk/?s=jasper+elgood
    The search results are from the search widget on the home page. I am not clear whether the search widget is from the theme or the jetpack plugin.

    I see that other shortcodes (images and embedded videos) are not working on the search results page either, so it is more likely that it is the formatting template for the search results page. If you have any suggestions if there are any settings I should change, that would be helpful. The template is a free one that I have to pay for support.

    https://www.ads-software.com/plugins/compact-wp-audio-player/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi, can you carry out a test. Can you test one of WordPress default themes like Twenty Fifteen. This will let you know if it is your theme causing the problem or not.

    Thread Starter karenyoung1

    (@karenyoung1)

    Thanks, that is a good idea. I will try out the plugin on a dev site with the same content, but default theme and see what happens and report back. Will be tomorrow probably.

    Thread Starter karenyoung1

    (@karenyoung1)

    This is how I have fixed the problem I was having, in case it helps anyone else. To fix it properly I should create a child theme and then alter the search.php in the child theme, but for the time being just to see if it will work, I have edited the search.php in the Dashboard > Appearance > Editor. This is a risky strategy if you don’t know PHP well and the best practice would be to create a child theme

    I noticed in the theme that I am using, on the home page template (page-home.php) in the part after the function query_posts there was a line that said
    get_template_part( ‘content’, get_post_format() );

    whereas in the search.php file (the template for the search results page) the line was
    get_template_part( ‘content’, ‘search’ );

    So it seemed to me if I changed ‘search’ to get_post_format() then the page would present the posts in the same format as the home page, which is what I wanted.

    The full line of code included a comment that said.
    /**
    * Run the loop for the search to output the results.
    * If you want to overload this in a child theme then include a file
    * called content-search.php and that will be used instead.
    */

    So I would urge anyone following this advice to set up a child theme. But I didn’t. I just went for changing it to see if it worked – and it did. The issue of not creating a child theme is that if the theme is updated this change could be lost.

    Changing to get_post_format() is not a universal solution – you need to compare what is in the page you want it to look like, because I looked at the same problem with the Twenty Twelve theme and I had to change the get_post_format() (which was in the search.php but which wasn’t working the way I wanted it to). I changed it to ‘post’ which is what was on the home page template, and then posts in the search results displayed the same as they did on the home page. Not everyone will want this, but I do. Some people may only want a summary/excerpt to display.

    By the way, this also fixed the display of other things governed by short codes, such as videos and images, which were not appearing.

    If anyone can give me a more technical explanation, that would be great.

    Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi I am happy to see that you have found a solution with your issue. If your issue is now resolved can you mark this support thread as resolved since the problem is not related to the plugin.

    Kind regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Not displaying player on search results’ is closed to new replies.