• Anonymous User 16123990

    (@anonymized-16123990)


    Or make it only search articles? It seems to search the whole site but I don’t want that.

    Also wondering if anyone could guide me through making a special fake sitemap or making one that directs to a 404 or the main site while having a hidden one.

    and also wondering if someone could help me on how I can remove the page titles from the Staff, Snapmatic, Videos, Crews, Forum and Contact page.

    Cheers

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi Charles,

    Limiting search to only “posts” is a matter of adding the following code into the “functions.php” file of your theme (hopefully a child theme!):

    // restrict search only to posts:
    function mo_search_only_posts($query) 
    {
        if (($query->is_search)&&(!is_admin())) {
            $query->set('post_type', 'post');
        }
        return $query;
    }
    add_filter('pre_get_posts','mo_search_only_posts');

    Hiding the search icon only could be done by adding the following code in the “Additional CSS” section. For this please go to the WP-Admin area and on the left side, under the “Appearance” -> “Customize”, click “Additional CSS” on the left side and paste this code in the text area:

    /* hiding the search icon */
    .header-search-wrapper {
      display: none;
    }

    Please beware that just hiding the icon does not remove the search feature, and directly accessing let’s say “https://wastedrockstars.com/?s=gta” will also return your Staff page among the results ??

    Good luck!

    Ahh, and about hiding the title – you could use this code, also in Additional CSS:

    h1.entry-title {
      display: none;
    }

    .. but I wouldn’t advise you positively on this because the <H1> tag is taken into account by search engines and hiding it could have some negative effects on that.

    How about styling it a bit nicer? ??

    Thread Starter Anonymous User 16123990

    (@anonymized-16123990)

    You’re a legend. Cheers Alex. Search now works how I wanted it to thanks to you. Had to disable a few plugins before it’d let me but it eventually let me save it all.
    About the headings, do you know of any other ways I could hide them without negatively influencing the search results?

    Also about the logo, is there any CSS I could add to remove the WastedRockstars text that appears for a split second? I’ve got a photo of it here: https://prntscr.com/jexmmp
    and while it does make the logo look really cool for a second and I might copy the way it looks, the times it does pop up for a split second can be really quite annoying. If you refresh a page a few times or click on each of them it’ll eventually happen to you. At least it does for me on Firefox anyway, on Edge it seems to load the page differently where the page won’t show until it’s all done.

    Cheers, and appreciate you – your website’s really damn cool too by the way.
    Charles

    Thanks for your kind words Charles ??

    The small red text showing in place of logo is the ALT text of the image,
    You could get rid of it with this CSS code added in “Additional CSS” section:

    /* hiding the ALT of the Logo */
    .site-branding .custom-logo-link img {
      color: rgba(0,0,0,0);
    }

    It actually makes it transparent. Don’t know if it’s alright SEO-wise because the algorithms aren’t public, but I also know that hiding stuff isn’t quite right – so please keep an eye on your Google Search Console, usually there will be a warning if something goes south.

    Same goes for the <H1> – it’s the most important thing on the page and it can’t be missing or hidden, unless you don’t care about search engines ranking, which would be pity for such a good looking website ?? . So, <H1> needs to be integrated somehow into the design.

    If you just want that white space white, then please try this CSS in “Additional CSS” and let me know what do you think ??

    /* styling the H1 */
    .entry-header h1.entry-title {
      text-align: right;
      margin-top: -62px;
      margin-right:  100px;
      color: #ff9c02;
      position:  absolute;
      right: 0;
    }
    @media (max-width:768px) {
      .entry-header h1.entry-title {
      margin-top: -52px;
      }
    }

    Best of luck!
    Alex.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Is there any way to hide my search button on the site? (and more)’ is closed to new replies.