Site logo

[Support request] Kopfbereich / Pagehero class

Home Forums Support [Support request] Kopfbereich / Pagehero class

Home Forums Support Kopfbereich / Pagehero class

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2510956
    Jochen

    Hey,

    I have two different Headers. One in a light version and another in dark.
    I gave one of them an element class „menu-light“ which is not added to the header.

    What can I do here? I don’t want to change to block elements.

    Best regards
    J

    #2511379
    Ying
    Staff
    Customer Support

    Hi Jochen,

    I don’t think I understand your question.

    Can you share more details and links?

    #2512899
    Jochen

    Hey Ying,

    with the added class „menu-light“ I can build the submenu in a light version.
    I need the class to control the css.
    Here is a screenshot:
    https://lorenzundfuchs.de/wp-content/uploads/2023/01/Bildschirm­foto-2023-01-29-um-14.31.53.png

    #2512908
    David
    Staff
    Customer Support

    Hi there,

    what are the Display Rules you’re using to set which Header Element is displayed?
    As we would need to add a CSS class to the body to make that work.

    #2512920
    Jochen
    #2513294
    Ying
    Staff
    Customer Support

    So the display rule is set as below?

    1. Front page
    2. Blog
    3. Post > all posts
    4. Page > impressum

    Can you link us to the impressum page?

    #2513720
    Jochen

    Hey,

    the project is wip and password protected.
    I send the info via private information.

    #2513948
    David
    Staff
    Customer Support

    Try adding this PHP Snippet to your site:

    add_filter( 'body_class', function( $classes ) {
        global $generate_elements;
        foreach ( $generate_elements as $element => $data ) {
            $element_title = 'gp-elem-' . strtolower(str_replace(' ', '-', get_the_title( $data['id'] ) ));
            $classes[] = $element_title;
        }
        return $classes;
    });

    In the body tag it will print a class like so: gp-elem-{elements-title} for each element on the page.
    For example i create an element titled: menu-light
    Then it will print a class: gp-elem-menu-light that you can use in your CSS.

    #2513950
    Jochen

    Hey David,

    thank you very much. It works now!

    Best regards
    Jochen

    #2514031
    David
    Staff
    Customer Support

    Glad to hear that!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.