Skip to main content
added 11 characters in body
Source Link

I am working on a wordpress code as shown below in which I want to show sticky post at the top.

The order should be in a way that stickymodified post should comedisplays at the top and then all the regular post.

$temp_args = [
    'post_type' => array('current-channel', 'post', 'current-episodes'),
    'post_status' => 'publish',
    'orderby' => array(
        'feat_yes' => 'ASC',
        'post_type' => 'ASC',
        'modified' => 'DESC',
        'date' => 'DESC'),
    'posts_per_page' => $data->{"no_articles_" . ICL_LANGUAGE_CODE},
    'tax_query' => [
        [
            'taxonomy' => 'category',
            'field' => 'term_id',
            'terms' => $cat_today,
        ],
    ],

];
$q = new WP_Query($temp_args);

At this moment, order by is done in the following way:

'orderby' => array(
    'feat_yes' => 'ASC',
    'post_type' => 'ASC',
    'modified' => 'DESC',
    'date' => 'DESC'),  

Problem Statement:

I am wondering what changes I should make in the code above so that sticky posts are displayed at the top before the regular post.

The order should be in a way that sticky post should be always at the top and then all the regular post

I am working on a wordpress code as shown below in which I want to show sticky post at the top.

The order should be in a way that sticky post should come at the top and then all the regular post.

$temp_args = [
    'post_type' => array('current-channel', 'post', 'current-episodes'),
    'post_status' => 'publish',
    'orderby' => array(
        'feat_yes' => 'ASC',
        'post_type' => 'ASC',
        'modified' => 'DESC',
        'date' => 'DESC'),
    'posts_per_page' => $data->{"no_articles_" . ICL_LANGUAGE_CODE},
    'tax_query' => [
        [
            'taxonomy' => 'category',
            'field' => 'term_id',
            'terms' => $cat_today,
        ],
    ],

];
$q = new WP_Query($temp_args);

At this moment, order by is done in the following way:

'orderby' => array(
    'feat_yes' => 'ASC',
    'post_type' => 'ASC',
    'modified' => 'DESC',
    'date' => 'DESC'),  

Problem Statement:

I am wondering what changes I should make in the code above so that sticky posts are displayed at the top before the regular post.

I am working on a wordpress code as shown below in which the modified post displays at the top.

$temp_args = [
    'post_type' => array('current-channel', 'post', 'current-episodes'),
    'post_status' => 'publish',
    'orderby' => array(
        'feat_yes' => 'ASC',
        'post_type' => 'ASC',
        'modified' => 'DESC',
        'date' => 'DESC'),
    'posts_per_page' => $data->{"no_articles_" . ICL_LANGUAGE_CODE},
    'tax_query' => [
        [
            'taxonomy' => 'category',
            'field' => 'term_id',
            'terms' => $cat_today,
        ],
    ],

];
$q = new WP_Query($temp_args);

At this moment, order by is done in the following way:

'orderby' => array(
    'feat_yes' => 'ASC',
    'post_type' => 'ASC',
    'modified' => 'DESC',
    'date' => 'DESC'),  

Problem Statement:

I am wondering what changes I should make in the code above so that sticky posts are displayed at the top before the regular post.

The order should be in a way that sticky post should be always at the top and then all the regular post

edited tags
Source Link

How to display sticky post always at the top (before regular post) in wordpress?

I am working on a wordpress code as shown below in which I want to show sticky post at the top.

The order should be in a way that sticky post should come at the top and then all the regular post.

$temp_args = [
    'post_type' => array('cpac'current-channel', 'post', 'cpac'current-episodes'),
    'post_status' => 'publish',
    'orderby' => array(
        'feat_yes' => 'ASC',
        'post_type' => 'ASC',
        'modified' => 'DESC',
        'date' => 'DESC'),
    'posts_per_page' => $data->{"no_articles_" . ICL_LANGUAGE_CODE},
    'tax_query' => [
        [
            'taxonomy' => 'category',
            'field' => 'term_id',
            'terms' => $cat_today,
        ],
    ],

];
$q = new WP_Query($temp_args);

At this moment, order by is done in the following way:

'orderby' => array(
    'feat_yes' => 'ASC',
    'post_type' => 'ASC',
    'modified' => 'DESC',
    'date' => 'DESC'),  

Problem Statement:

I am wondering what changes I should make in the code above so that sticky posts are displayed at the top before the regular post.

How to display sticky post at the top (before regular post) in wordpress?

I am working on a wordpress code as shown below in which I want to show sticky post at the top.

The order should be in a way that sticky post should come at the top and then all the regular post.

$temp_args = [
    'post_type' => array('cpac-channel', 'post', 'cpac-episodes'),
    'post_status' => 'publish',
    'orderby' => array(
        'feat_yes' => 'ASC',
        'post_type' => 'ASC',
        'modified' => 'DESC',
        'date' => 'DESC'),
    'posts_per_page' => $data->{"no_articles_" . ICL_LANGUAGE_CODE},
    'tax_query' => [
        [
            'taxonomy' => 'category',
            'field' => 'term_id',
            'terms' => $cat_today,
        ],
    ],

];
$q = new WP_Query($temp_args);

At this moment, order by is done in the following way:

'orderby' => array(
    'feat_yes' => 'ASC',
    'post_type' => 'ASC',
    'modified' => 'DESC',
    'date' => 'DESC'),  

Problem Statement:

I am wondering what changes I should make in the code above so that sticky posts are displayed at the top before the regular post.

How to display sticky post always at the top (before regular post) in wordpress?

I am working on a wordpress code as shown below in which I want to show sticky post at the top.

The order should be in a way that sticky post should come at the top and then all the regular post.

$temp_args = [
    'post_type' => array('current-channel', 'post', 'current-episodes'),
    'post_status' => 'publish',
    'orderby' => array(
        'feat_yes' => 'ASC',
        'post_type' => 'ASC',
        'modified' => 'DESC',
        'date' => 'DESC'),
    'posts_per_page' => $data->{"no_articles_" . ICL_LANGUAGE_CODE},
    'tax_query' => [
        [
            'taxonomy' => 'category',
            'field' => 'term_id',
            'terms' => $cat_today,
        ],
    ],

];
$q = new WP_Query($temp_args);

At this moment, order by is done in the following way:

'orderby' => array(
    'feat_yes' => 'ASC',
    'post_type' => 'ASC',
    'modified' => 'DESC',
    'date' => 'DESC'),  

Problem Statement:

I am wondering what changes I should make in the code above so that sticky posts are displayed at the top before the regular post.

Source Link

How to display sticky post at the top (before regular post) in wordpress?

I am working on a wordpress code as shown below in which I want to show sticky post at the top.

The order should be in a way that sticky post should come at the top and then all the regular post.

$temp_args = [
    'post_type' => array('cpac-channel', 'post', 'cpac-episodes'),
    'post_status' => 'publish',
    'orderby' => array(
        'feat_yes' => 'ASC',
        'post_type' => 'ASC',
        'modified' => 'DESC',
        'date' => 'DESC'),
    'posts_per_page' => $data->{"no_articles_" . ICL_LANGUAGE_CODE},
    'tax_query' => [
        [
            'taxonomy' => 'category',
            'field' => 'term_id',
            'terms' => $cat_today,
        ],
    ],

];
$q = new WP_Query($temp_args);

At this moment, order by is done in the following way:

'orderby' => array(
    'feat_yes' => 'ASC',
    'post_type' => 'ASC',
    'modified' => 'DESC',
    'date' => 'DESC'),  

Problem Statement:

I am wondering what changes I should make in the code above so that sticky posts are displayed at the top before the regular post.