metabox - How to get custom post type with dynamic ID

I want to show a custom post type chosen from the meta box dropdown list but i am getting this error Notice: Trying to g

I want to show a custom post type chosen from the meta box dropdown list but i am getting this error Notice: Trying to get property of non-object in C:\xampp\htdocs\wordpress\wp-content\themes\affiliator\footer.php on line 20 Here is my code:

$get_footer = get_post_meta( get_the_id(), 'af_choose_layout', true );

if( !empty( $get_footer ) ){
      $footer = get_post( $get_footer  );
      echo apply_filters('the_content',$footer->post_content);
}

So i just want to get the id of the custom post that can be usable for get_post(some id here...). Please help me to fix this

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744586047a4582315.html

相关推荐

  • metabox - How to get custom post type with dynamic ID

    I want to show a custom post type chosen from the meta box dropdown list but i am getting this error Notice: Trying to g

    2天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信