[Support request] Unique header for a specific part of site

Home Forums Support Unique header for a specific part of site

  • This topic has 32 replies, 3 voices, and was last updated 2 months ago by Tom.
Viewing 15 posts - 16 through 30 (of 33 total)
  • Author
    Posts
  • #1192623
    Matthew

    I left <!-- merged header --> in the page hero content but removed the 150px padding.

    and added back in the ofset site header height of 150px.

    this worked as well.

    #1192624
    David
    Staff
    Customer Support

    Yep 🙂 Glad to hear that

    #1239546
    Matthew

    I set the secondary menu for display, pls see below:

    https://drive.google.com/open?id=1s4WTCbicghejpwMZVux5RtWQzNPhThij

    Page is tucked underneath this menu, so it’s the same problem as before.

    Is there an alternative solution.

    thanks,

    #1239923
    David
    Staff
    Customer Support

    Simplest method would be to increase the Site Header offset or elements top padding to compensate for the secondary navigation.

    Or we can use a filter to switch the logos and some CSS to change the background. If this is preferred then we would need to see a custom post type to figure out the requirements.

    #1240884
    Matthew

    Hi David,

    Adding new or more offset amounts doesn’t seem like a very dynamic way to do this as it presents a problem because I am showing the secondary menu on certain condition, only if user has created an order (I’m going to get someone to code this). Otherwise it’s not displayed.

    Possibly I could have the offset customised too as part of the above work, when the menu is set to display.

    For now though the filter technique might work. If it provides the same exactness (aside from the margin problem currently, the logo lines up perfectly etc.). Would the filter provide the other various controls that the header element does such as under Site Header and Display Rules tabs? (I actually probably won’t need these so just curious; switching the logo and background color is likely to be all that’s required).

    The CPT is ‘Pictures’ and a sample article is:
    https://www.imjexa.com/pictures/nebula-images/

    I put my wp-admin URL and U/P in earlier.

    thanks,

    #1241279
    David
    Staff
    Customer Support

    Having trouble logging in – can you send the details via the Account Issue form here:
    https://generatepress.com/contact/

    Please add the URL for this topic so we can track.

    #1242320
    Matthew

    The user name and password I put in the ‘Your website URL’ that only admins can see is the correct one.

    I put my wp admin URL in there, followed by the user name and password, but the field adds extra characters which makes it confusing for you to see the actual U/P. It would be better to have a website URL field and a separate U & P field; can you confirm it’s the admin URL I am providing in the ‘Your website URL’ field each time? I’m assuming is it, so you can properly check the setup, and in which case you’ll need the U/P as well. Or – I can just send the details using the account issue form from now on.

    Will do now, pls check for me

    thanks,

    #1242624
    David
    Staff
    Customer Support

    We’re looking at better more secure solutions for providing login info – we ideally want to avoid holding anyones admin details for any period of time – hence the current half arsed method.

    So this CSS for changing the Header background:

    .single-pictures .site-header {
        background-color: #000;
    }

    And this PHP filter for switching the logo:

    add_filter( 'generate_logo_output', function( $logo_url ) {
        if ( is_singular( 'pictures' ) ) {
            $logo_url = 'URL TO CUSTOM LOGO';
        }
    
        return $logo_url;
    } );

    Reference: https://docs.generatepress.com/article/generate_logo_output/

    #1247425
    Matthew

    This isn’t working, currently the result is:

    https://drive.google.com/open?id=1pct1EbZTTVZyihFDsZrwkaPAu9IoHKN2

    I put the URL as below:

    add_filter( 'generate_logo_output', function( $logo_url ) {
        if ( is_singular( 'pictures' ) ) {
            $logo_url = 'http://www.imjexa.com/wp-content/uploads/2020/03/imjexa_logo_web_interplay.jpg';
        }
    
        return $logo_url;
    } );

    Which I copied from the File URL field in the media items edit screen:

    https://drive.google.com/open?id=1Jcxc5oP540Kuk2Osn4t5e6ovffO5iIHE

    thanks,

    #1247887
    David
    Staff
    Customer Support

    Ooops gave you the totally incorrect filter – try this:

    add_filter( 'generate_logo','tu_category_logo' );
    function tu_category_logo( $logo ) {
        
        // Return our category logo URL
        if ( is_singular( 'pictures' ) ) {
            return 'URL TO YOUR CATEGORY LOGO';
        }
    
        // Otherwise, return our default logo
        return $logo;
    }

    Reference: https://docs.generatepress.com/article/generate_logo/

    #1248719
    Matthew

    The logo’s still not showing.

    add_filter( 'generate_logo','tu_category_logo' );
    function tu_category_logo( $logo ) {
        
        // Return our category logo URL
        if ( is_singular( 'pictures' ) ) {
            return 'http://www.imjexa.com/wp-content/uploads/2020/03/imjexa_logo_web_interplay.jpg';
        }
    
        // Otherwise, return our default logo
        return $logo;
    }

    But if I change pictures to picture, as below:

    if ( is_singular( 'picture' ) ) {

    I get a logo but it’s the other version i.e. the logo that is for all the other site pages and with the URL of:

    http://www.imjexa.com/wp-content/uploads/2020/02/imjexa_logo_web-1.jpg

    Firstly can you confirm that using the singular version of the CPT is correct, should I keep it as ‘picture’? Please refer to my CPT source code:

    https://drive.google.com/open?id=14UvnCVzIZHqQhz_vkSfni2alQSSZ09m1

    And second is the URL I entered for the above source code the correct format? As said earlier, I got it from:

    https://drive.google.com/open?id=1Jcxc5oP540Kuk2Osn4t5e6ovffO5iIHE

    This seems like it could be a cache issue, but I have cleared the browser cache (only ‘Cached images and files’) and also done a “Purge All” in the Litespeed Cache plug-in.

    thanks,

    #1249555
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    One issue I’m seeing is you’re loading the URL using http://, even though the site is using https://.

    This will prevent the logo from appearing in some browsers as it’s unsecured.

    Can you make use https in your code, instead?

    Also, It looks like your retina logo in Customize > Site Identity is also using http – can you remove that and re-upload it so it uses https?

    Let me know 🙂

    #1258813
    Matthew

    Thanks Tom it works.

    Along with https instead of http I had to use the plural i.e.:

    if ( is_singular( 'pictures' ) ) {

    Before when things were’t right picture returned the (albeit wrong) logo while pictures didn’t return anything.

    I wouldn’t of known about https because I simply used the URL from the File URL: field of the media item in media library.

    Your advice about the retina logo, I am not sure what you mean in regards to making it use https. The change I made for https was to the filter code in my site-specific plugin, which is for the standard logo.

    That was going to be my next question, how does this filter fetch my retina logo? I have now re-uploaded both the standard and retina logos again because the permalink was affected by the GP Element where I formerly used them, i.e.

    http://www.imjexa.com/gp_elements/ … name of logo file etc

    I also deleted the GP Element now because the filter is working well and replaces it, solving the offset problem.

    So the next steps are to use my retina logo with this filter. And also the mobile screen no longer has any logos at all, how can I ensure phone display the logos as well.

    thanks,

    #1259856
    Tom
    Lead Developer
    Lead Developer

    The filter for the retina logo is: generate_retina_logo

    So the filter would be the exact same, but you’d use generate_retina_logo instead of generate_logo.

    Make sure your site URL is using https in “Settings > General” or you’ll run into all kinds of issues like this. Right now the retina logo is still using http which is why it isn’t showing up.

    #1260482
    Matthew

    So I kept my original filter without modifying it, and added another directly beneath it as below:

    add_filter( 'generate_retina_logo','tu_category_logo' );
    function tu_category_logo( $logo ) {
        
        // Return our category logo URL
        if ( is_singular( 'pictures' ) ) {
            return 'https://www.imjexa.com/wp-content/uploads/2020/04/imjexa_logo_web_interplay@2x.jpg';
       }
    
        // Otherwise, return our default logo
        return $logo;
    }

    Unfortunately I am getting the white screen of death currently,
    Have I done it wrong?

    Thanks,

    Also, in Settings > General, do I change to https for both WordPress Address (URL) and Site Address (URL)?

Viewing 15 posts - 16 through 30 (of 33 total)
  • You must be logged in to reply to this topic.