Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1028064
    GhostWhale
    Participant

    Hi,

    I’m nearly done with my site. Once of the last things I’m trying to work out is how to format the search results. I would like to:
    1. Change the featured image rollover colour to:
    2. Replace the ‘link’ icon that appears on image rollover with the test ‘READ MORE’.
    3. Change the ‘read more’ link that follows the excerpt text to be a button as per the theme default button settings.
    4. Ensure that a particular sidebar appears on all search result pages.

    Can you let me know if any/all of this is possible and how to achieve it.

    Thanks

    #1028065
    GhostWhale
    Participant
    This reply has been marked as private.
    #1028294
    Thai
    Moderator

    Hi There,

    Please add the following CSS under Customizer > Custom > Global CSS:

    .entry-thumb {
        background-color: #a92e2e;
    }
    a.entry-thumb:before {
        display: none;
    }
    .more-link {
        position: relative;
        display: inline-block;
        border: 2px solid;
        padding: 8px 20px;
        text-transform: uppercase;
        font-size: 12px;
    }
    .more-link:hover {
        color: hsl(0,0%,0%);
        border-color: hsl(0,0%,36%);
        background-color: hsla(31,96%,70%,0.57);
    }

    Hope it helps 🙂

    #1028420
    GhostWhale
    Participant

    Thanks, 90% of the way there.

    The link icon is gone on rollover which is great, is it not possible to have ‘read more’ displayed in it’s place? This’d be nice but by no means critical.

    How can i center align the ‘read more’ button that now displays?

    What about questions 4 above? Is it possible to have a sidebar permenantly displayed on search results pages?

    #1029142
    Rad
    Moderator

    Hi there,

    Please replace this CSS

    a.entry-thumb:before {
        display: none;
    }

    with this

    a.entry-thumb:before {
        content: "read more";
    }

    About the alignment and since The Grid, then should be like this

    .quito .tg-item-read-more {
    text-align: center;
    }

    About the 4th question, yes possible. Please add this code to your child theme’s functions.php with your sidebar ID (ID are available from Admin > Appearance > Sidebars)

    function x_get_content_layout() {
    
        $content_layout = x_get_option( 'x_layout_content' );
    
        if ( $content_layout != 'full-width' ) {
          if ( is_home() ) {
            $opt    = x_get_option( 'x_blog_layout' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_singular( 'post' ) ) {
            $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
            $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
          } elseif ( x_is_portfolio_item() ) {
            $layout = 'full-width';
          } elseif ( x_is_portfolio() ) {
            $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
            $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
          } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
            $layout = 'content-sidebar';
          } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
            $layout = 'sidebar-content';
          } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
            $layout = 'full-width';
          } elseif ( is_archive() ) {
            if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
              $opt    = x_get_option( 'x_woocommerce_shop_layout_content' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            } else {
              $opt    = x_get_option( 'x_archive_layout' );
              $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
            }
          } elseif ( x_is_product() ) {
            $layout = 'full-width';
          } elseif ( x_is_bbpress() ) {
            $opt    = x_get_option( 'x_bbpress_layout_content' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( x_is_buddypress() ) {
            $opt    = x_get_option( 'x_buddypress_layout_content' );
            $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
          } elseif ( is_404() ) {
            $layout = 'full-width';
          } else {
            $layout = $content_layout;
          }
        } else {
          $layout = $content_layout;
        }
    
        if ( is_search() ) {
          $layout = 'content-sidebar';
        }
    
        return $layout;
    
      }
    
    add_filter( 'ups_sidebar', 'custom_ups_display_sidebar', 999 );
    
    function custom_ups_display_sidebar ( $sidebar ) {
    
    return is_search() ? 'YOUR-SIDEBAR-ID-HERE' : $sidebar;
    
    }
    

    Hope this helps.

    #1030427
    GhostWhale
    Participant

    Hi. So the first one works but looks terrible. I’d like it to look like the attached screenshot from The Grid. If this isn’t possible it’s fine, I’ll go without.

    The second point about centre aligning the ‘read more’ button doesn’t work.

    The sidebar code works great. thanks.

    #1031253
    Rupok
    Member

    Hi there,

    Thanks for updating. It’s not actually recommended to modify the default behavior. If you need more customization, you can play with the code from the given example.
    Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities. Thanks for understanding.

  • <script> jQuery(function($){ $("#no-reply-1028064 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>