Online and local's problem for get_post_meta

Home Forums WPAlchemy Online and local's problem for get_post_meta

This topic contains 0 replies, has 1 voice, and was last updated by  porpor 10 months, 4 weeks ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #2579

    porpor
    Participant

    I am using WPAlchemy MetaBox plugin in my theme files!. I tested and created themes with that plugins and everything works smothly. But, When I uploaded my theme file to my hosting. It doesn’t work and I looked for the problem and I found it. that is …

    this code work at online, not work on localhost

    <code>

    function custom_slider() {

    global $aa_slider_metabox;
    $aa_all_slide = get_post_meta($post->ID, $aa_slider_metabox->get_the_id(), TRUE);

    //Some extract code here!

    }

    </code>

    This code doesn’t work at online, but work on localhost

    <code>

    function custom_slider() {

    global $aa_slider_metabox, $post;   //only add $post
    $aa_all_slide = get_post_meta($post->ID, $aa_slider_metabox->get_the_id(), TRUE);

    //Some extract code here!

    }

    //OR

    function custom_slider() {

    global $aa_slider_metabox;   //only add $post
    $aa_all_slide = get_post_meta(get_theID(), $aa_slider_metabox->get_the_id(), TRUE);

    //Some extract code here!

    }

     

    </code>

     

    Please help me the code that can work both localhost and online, Thanks people

    • This topic was modified 10 months, 4 weeks ago by  porpor.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.