Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Light mode dark mode toggle #10069
    blankjames
    Participant

    You don’t seem to have code that changes themeToggleLight.style.visibility. Does this help?

    if (themeToggleLight.style.visibility == "hidden") {
        themeToggleLight.style.visibility = "visible";
        themeToggleDark.style.visibility = "hidden";
    } else {
        themeToggleLight.style.visibility = "hidden";
        themeToggleDark.style.visibility = "visible";
    }
    
    in reply to: How can I get the current page name in WordPress? #9410
    blankjames
    Participant

    You can get the current page, post, or custom post type with the global variable $post:

    echo $post->post_title
    

    Note: In a function or class you’ll need to specify global $post; prior to trying to use $post.

    If you have loops on your page, make sure you end each loop with wp_reset_postdata(); to set $post back to the default item being displayed (the page).

    Note, the ‘post_title’ variable is also available for any custom loop / query… including menu items and media attachments… everything in WordPress is a ‘post’.

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