• Resolved 1secureweb

    (@1secureweb)


    I am writing my own function (as a plugin). So far so good. My problem is being able to write the correct $args to create my $query so that I only get, say,

    • top 8 posts
    • category=1
    • contains video content (table wp_postmeta: meta_key=post_video – meta_value is not null)

    It is this last line criteria to check the video content that I have not been able to do so far.
    Any help or pointers would be appreciated

    Thanks
    Paul

    • This topic was modified 9 years, 9 months ago by 1secureweb.
Viewing 1 replies (of 1 total)
  • Thread Starter 1secureweb

    (@1secureweb)

    Managed to find a solution to my own question

    <?php
    $newscategory = ‘1’;
    $args = array(
    ‘posts_per_page’ => ‘8’,
    ‘category__in’ => $newscategory,
    no_found_rows’ => true,

    ‘meta_query’ => array(
    array(
    ‘key’ => ‘post_video’,
    ‘value’ => ”,
    ‘compare’ => ‘!=’
    )
    )
    );

    ?>

Viewing 1 replies (of 1 total)

The topic ‘Selecting only posts with video content’ is closed to new replies.