Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1152495
    Mike Harrison
    Participant

    Would like to get this implemented into the theme so my child themes do not have to override. All it is doing is adding another check to see if the GLOBAL $post exists (on author pages, there is no ID and gives a notice of trying to get property of a non-object). The function is used in multiple places and this would just be the easiest change.

    File location: x/framework/functions/global/helper.php

    function x_get_the_ID() {
    
      GLOBAL $post;
    
      if ( is_home() ) {
        $id = get_option( 'page_for_posts' );
      } elseif ( x_is_shop() ) {
        $id = woocommerce_get_page_id( 'shop' );
      } elseif ( is_404() ) {
        $id = NULL;
      } elseif(isset($post->ID)) {
        $id = $post->ID;
      } else {
          $id = '';
      }
    
      return $id;
    
    }

    Thanks,
    Mike

    #1152829
    Rupok
    Member

    Hi Mike,

    Thanks for writing in! Regretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (a link to a similar example site would be very helpful, or perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.

  • <script> jQuery(function($){ $("#no-reply-1152495 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>