Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #288
    Profile photo of Alessandro0770
    Alessandro0770
    Participant

    Do you know how I can display 100 images in the results page of the search engine of my site? Now with the default configuration I see only 24 images.
    Thanks a lot!

    #3117
    Profile photo of JoAnnSnover
    JoAnnSnover
    Participant

    Right now, you would need to edit functions.php to do this. I think it should be a UI option in the WordPress dashboard, but I did make the edit on my own site to change the default from 24 to 48 – that works for Category browsing or search results from your site (network search results use a different parameter.

    It’s better to use a multiple of 6 given how the pages are laid out – at least for clean theme.

    Here is the change:

    //set the results per page depending on if we are doing image search
    function symbiostock_image_results_per_page( $query ) {
    $network_search = get_query_var(‘symbiostock_network_search’);

    if($network_search != true && !is_admin()){
    $marketer_user_key = get_option(‘marketer_user_number’);
    $marketer_key = get_query_var( ‘ss-‘ . $marketer_user_key );

    // jas – original per_page was 24; multiples of 6 work best
    // jas begin
    isset($marketer_key ) && !empty($marketer_key) ? $per_page = 100 : $per_page = 48;
    // jas end
    $query->set(‘posts_per_page’, $per_page);
    return;
    }
    }

    #3118
    Profile photo of Alessandro0770
    Alessandro0770
    Participant

    Thanks jsnover!!
    Works all fine 🙂

    #3119
    Profile photo of DonLand
    DonLand
    Participant

    Any idea of how to do it with the default child theme?

    #3120
    Profile photo of JoAnnSnover
    JoAnnSnover
    Participant

    The change I made is to functions.php in the parent theme.

    You can make a functions.php in the default child theme and put just that one function into it if you prefer to edit things that way, but be aware that if the parent theme’s version of that function changes in the future, your older (based on the prior version) function will be used. That may or may not be OK depending on what else has changed.

    This sort of thing needs to be a parameter pulled from the UI, not code in either the parent or child theme, but I just offered this as a quick fix.

    Do keep a copy somewhere other than on the site of what you’ve edited so you can re-apply the changes after an update (assuming the change is still needed)

    #3121
    Profile photo of DonLand
    DonLand
    Participant

    The Symbiostock child does have a functions.php file already. I pasted the above code into it but nothing changed.

    #3122
    Profile photo of Christine
    Christine
    Participant

    This is a link to a Code Editor that Leo created exactly for adding code for more images – I wonder if it could be used for more things?

    http://www.symbiostock.com/products-page/product-category/symbiostock-genetic-lab-code-modifier-and-enhancer/

    http://kerioakimaging.com - trying to reopen
    http://nail-art-at.kerioak.com - Art and Nail Art

    #3123
    Profile photo of JoAnnSnover
    JoAnnSnover
    Participant

    @donland wrote:

    The Symbiostock child does have a functions.php file already. I pasted the above code into it but nothing changed.

    You have to paste the whole function, not a snippet from the middle of one.

    #3124
    Profile photo of JoAnnSnover
    JoAnnSnover
    Participant

    @christine wrote:

    This is a link to a Code Editor that Leo created exactly for adding code for more images – I wonder if it could be used for more things?

    http://www.symbiostock.com/products-page/product-category/symbiostock-genetic-lab-code-modifier-and-enhancer/

    And is there a “code snippet archive” somewhere?

    I don’t think changing the number of images per page of results should require code at all – it’s a parameter that right now is a magic number hardcoded in a PHP file and it needs to be pulled from the UI instead (with possibly some simple limits and a default of 24).

    Without seeing the code for this plugin I can’t really say, but it sounds as if it’s an editor for functions.php somewhat like Jetpack’s Edit CSS for style.css. There was no mention of the user saying which PHP file the code snippet was to be injected into.

    And for many of the items I’ve done kludgey changes for, you couldn’t change those behaviors by stuffing a code snippet elsewhere – it would have to modify the function in the PHP file that currently implements the behavior someone wants to alter.

    #3125
    Profile photo of DonLand
    DonLand
    Participant

    I did. I pasted everything from under but not including “Here is the change:”

    I pasted it below all of the following:

    < ?php
    //write your functions below, they will be added to Symbiostock’s functionality
    //more on child theme function writing here: http://codex.wordpress.org/Child_Themes

    ?>

    #3126
    Profile photo of JoAnnSnover
    JoAnnSnover
    Participant

    You need to have your code within the php tags – after the comment and before the ?>

    #3127
    Profile photo of DonLand
    DonLand
    Participant

    Thank you. That is why I posted where I put it because I thought I may have made a mistake as I am not familiar with coding.

    #3128
    Profile photo of DonLand
    DonLand
    Participant

    Thanks but I keep getting an error when the code is within:

    Fatal error: Cannot redeclare symbiostock_image_results_per_page() (previously declared in /home

    I’ve tried removing the entire child theme and reinstalling it. I used a text editor to drop it in as well as the editor within WP.

    #3129
    Profile photo of JoAnnSnover
    JoAnnSnover
    Participant

    Just a note for anyone using the batch editor. I am getting a strange error message if I go to the Settings & Pricing section when the change I made here is in functions.php.

    It makes no sense to me, but while I investigate, should you encounter the batch error message “This option not available with this host.”, just go back to the original (unedited) functions.php

Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.