plugin development - how to get link of added document with a post

I am working on a mobile application with back-end wordpress database. In wordpress there is a button on each post conta

I am working on a mobile application with back-end wordpress database. In wordpress there is a button on each post container top with name of "Add Media" where we can add video , audio and documents into our posts. in my scenario each post has a PDF file and a thumbnail image for that pdf file. i want to query to get a post with its attached pdf and its thumbnail paths. what i did before but had not expected result.

    public  function  AllPosts(){

   $args = array(
    'post_parent'    =>'2081',
    'post_type'      => 'attachment',
    'post_mime_type' => 'application/pdf',
    'posts_per_page' => -1,
    'orderby'        => 'menu_order',
    'order'          => 'ASC',
);
$args = apply_filters( 'get_attached_media_args', $args, 'application/pdf', '2081');

$children = get_children( $args );

and some othere custom mysql query

SELECT wp_posts . * , wp_postmeta . * 
FROM wp_posts
JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id
JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.object_id
JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = 
wp_term_taxonomy.term_taxonomy_id
JOIN wp_terms ON wp_term_taxonomy.term_id = wp_terms.term_id
WHERE (
wp_terms.name =  'PostCategoryName'
)

please someone help. thank you

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

相关推荐

  • plugin development - how to get link of added document with a post

    I am working on a mobile application with back-end wordpress database. In wordpress there is a button on each post conta

    6小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信