Midwest Dev Chat

MidwestDevChat.com

  • The newest 15 messages in the super-cool #wordpress channel.

  • 10/04 15:08:13 Antonina: anyone ever had success overriding the global $post variable?
    function someTestFunctionToSeeIfThisWorks()
    {
        if (is_post_type_archive('modelhome')) {
            global $post;
            $overviewPage = get_page_by_path('our-locations/model-homes');
            $GLOBALS['post'] = $overviewPage;
            // error_log(print_r($post, true));
        }
    }
    
    add_action('wp', 'someTestFunctionToSeeIfThisWorks');
    
    I'm using the wp action, and that all works fine. But then in functions that run later it's not recognizing that global (or it's being overwritten somewhere...)
  • 10/04 15:08:51 Antonina: Basically I want the post type archive to recognize a standard page in the back-end as the global $post
  • 10/04 15:09:13 Antonina: Rather than the default behavior of showing the first post result in the query
  • 10/04 15:29:58 Antonina: I probably just need to find a different way to go about this
  • 10/06 11:06:45 Ellis: Hey room! A friend of mine set up a WordPress site, and needs someone to help him figure out some things. He's looking for a tutor of sorts. He's technical enough to be dangerous, but definitely not a programmer. Anybody interested in a gig like that on an hourly basis? DM me and I'll make the connection. Thanks!
  • 10/08 12:53:39 Ellis: Neglected to mention - he's in Omaha... thanks!
  • *Usernames have been changed to protect the innocent.
We're currently 1106 members strong. Join us!
Request Invite

Check out all the cool channels!

Join the conversation!