Shortcode no longer displaying custom post type












0















I created a testimonial post type to display reviews I have inputted on my site. then I created two functions to create a testimonial block that would display these reviews on certain pages with a shortcode. At first all was working fine but then as I added more and more testimonials they stopped displaying and I have not been able to figure out why. Does anyone have any experience with this. See the two functions include in my functions.php below:



//Testimonial widget
function sal_testimonials_widget($atts){

//shortcode options
extract(
shortcode_atts(
array(
'section_title' => 'Testimonials',
'custom_location_filter' => '',

), $atts
)
);

//post data
$filter_ids = '';
$post_type = '';

//initial variables
$location_filter = '';


$custom_filters_added = ($custom_location_filter !== '' ? true : false);

if($custom_filters_added){
if($custom_location_filter !== ''){
$filter_ids = $custom_location_filter;
$post_type = 'Locations';
}

}else{
global $post;
$post_type = $post->post_type;
$filter_ids= $post->ID;
}

$output = '<div class="testimonials-block-container">';
$output.= sal_testimonials_block($post_type, true, $filter_ids, $section_title);
$output.= '</div>';
wp_reset_postdata();
return $output;
}

add_shortcode('testimonials_widget', 'sal_testimonials_widget');

////Testimonials block
function sal_testimonials_block($testimonial_type, $enabled, $id, $section_title){
$testimonial_args = array(
'posts_per_page' => $init_amount_to_display,
'offset'=> 0,
'post_type' => 'testimonials',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC'
);

$testimonials_id_array = array();

$testimonials = get_posts( $testimonial_args );
$current_post_id = get_the_ID();
$current_post_type=get_post_type($current_post_ID);
$output.='<div class="testimonial-slideshow">';
if($testimonials):
foreach ($testimonials as $item) {

$location = get_field('location_associated_with_testimonial', $item );
$city= get_field('city', $location);
$state= get_field('state', $location);
$author=get_field('testimonial_authors_name', $item);
$universal=get_field('is_universal', $item);
$date=get_field('testimonial_date', $item);
$customer_city=get_field('customer_city', $item);

if($location==$current_post_id){
$output.='<div class="testimonial-slide">';
$output.= '<div class="testimonial-item">';
$output.= '<q class="testimonial">' . get_post_field('post_content', $item) . '</q>';
$output.= ( $author ? '<div class="testimonial-author">' . $author . '</div>' : '' );

$output.='<div class="testimonial-location">';
if(strlen($customer_city)>1){$output.=$customer_city;}
else{$output.= $city . ', ' . $state;}
$output.='</div>';
$output.= ( $date ? '<div class="testimonial-date">' . $date . '</div>' : '' );
$output.= '</div>';
$output.='</div>';
}
if($testimonial_type!='locations'&&$universal==true){
$output.='<div class="testimonial-slide">';
$output.= '<div class="testimonial-item">';
$output.= '<q class="testimonial">' . get_post_field('post_content', $item) . '</q>';
$output.= ( $author ? '<div class="testimonial-author">' . $author . '</div>' : '' );
$output.='<div class="testimonial-location">';
if(strlen($customer_city)>1){$output.=$customer_city;}
else{$output.= $city . ', ' . $state;}
$output.='</div>';
$output.= ( $date ? '<div class="testimonial-date">' . $date . '</div>' : '' );
$output.= '</div>';
$output.='</div>';
}
wp_reset_postdata();
}
$output.='</div>';

endif;

return $output;



}


I also used some JavaScript (JQuery) to make a slider to display multiple testimonials on a single page. See below:



/*
* Location Single Page Testimonial Slideshow
* Add slick slider to the testimonial section of the lcoation page
*/
if ($(".testimonial-slideshow").length > 0) {
$(".testimonial-slideshow").slick({
dots: false,
infinite: true,
speed: 300,
fade: false,
cssEase: "ease",
autoplay: true,
autoplaySpeed: 8000,
prevArrow:
'<div class="slick-prev"><i class="fa fa-chevron-left"></i></div>,',
nextArrow:
'<div class="slick-next"><i class="fa fa-chevron-right"></i></div>',
draggable: false,
responsive: [
{
breakpoint: 768,
settings: {
draggable: true
}
}
]
});
}


I tried flushing the rewrite rules in multiple areas for the custom post type but it seemed to have no effect.










share|improve this question

























  • It could be the data in one of the testimonials. Check for error messages both on the server and in the developer console. Try reducing the number of testimonials and increase it by 1 until you find the one that breaks it.

    – aynber
    Nov 21 '18 at 16:36











  • @aynber What type of data do you think could break it? Each testimonial was individually created manually.

    – Blaise
    Nov 21 '18 at 16:40











  • It's really hard to tell. It could be a rogue character or code. If it works with one or two but breaks after a certain amount or certain testimonial, it's usually something within that testimonial that you may have to escape out.

    – aynber
    Nov 21 '18 at 16:42











  • @aynber also what is strange is that when I add a new testimonial. it will display with the shortcode at first but will eventually disappear from view a few page refreshes later.

    – Blaise
    Nov 21 '18 at 16:43
















0















I created a testimonial post type to display reviews I have inputted on my site. then I created two functions to create a testimonial block that would display these reviews on certain pages with a shortcode. At first all was working fine but then as I added more and more testimonials they stopped displaying and I have not been able to figure out why. Does anyone have any experience with this. See the two functions include in my functions.php below:



//Testimonial widget
function sal_testimonials_widget($atts){

//shortcode options
extract(
shortcode_atts(
array(
'section_title' => 'Testimonials',
'custom_location_filter' => '',

), $atts
)
);

//post data
$filter_ids = '';
$post_type = '';

//initial variables
$location_filter = '';


$custom_filters_added = ($custom_location_filter !== '' ? true : false);

if($custom_filters_added){
if($custom_location_filter !== ''){
$filter_ids = $custom_location_filter;
$post_type = 'Locations';
}

}else{
global $post;
$post_type = $post->post_type;
$filter_ids= $post->ID;
}

$output = '<div class="testimonials-block-container">';
$output.= sal_testimonials_block($post_type, true, $filter_ids, $section_title);
$output.= '</div>';
wp_reset_postdata();
return $output;
}

add_shortcode('testimonials_widget', 'sal_testimonials_widget');

////Testimonials block
function sal_testimonials_block($testimonial_type, $enabled, $id, $section_title){
$testimonial_args = array(
'posts_per_page' => $init_amount_to_display,
'offset'=> 0,
'post_type' => 'testimonials',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC'
);

$testimonials_id_array = array();

$testimonials = get_posts( $testimonial_args );
$current_post_id = get_the_ID();
$current_post_type=get_post_type($current_post_ID);
$output.='<div class="testimonial-slideshow">';
if($testimonials):
foreach ($testimonials as $item) {

$location = get_field('location_associated_with_testimonial', $item );
$city= get_field('city', $location);
$state= get_field('state', $location);
$author=get_field('testimonial_authors_name', $item);
$universal=get_field('is_universal', $item);
$date=get_field('testimonial_date', $item);
$customer_city=get_field('customer_city', $item);

if($location==$current_post_id){
$output.='<div class="testimonial-slide">';
$output.= '<div class="testimonial-item">';
$output.= '<q class="testimonial">' . get_post_field('post_content', $item) . '</q>';
$output.= ( $author ? '<div class="testimonial-author">' . $author . '</div>' : '' );

$output.='<div class="testimonial-location">';
if(strlen($customer_city)>1){$output.=$customer_city;}
else{$output.= $city . ', ' . $state;}
$output.='</div>';
$output.= ( $date ? '<div class="testimonial-date">' . $date . '</div>' : '' );
$output.= '</div>';
$output.='</div>';
}
if($testimonial_type!='locations'&&$universal==true){
$output.='<div class="testimonial-slide">';
$output.= '<div class="testimonial-item">';
$output.= '<q class="testimonial">' . get_post_field('post_content', $item) . '</q>';
$output.= ( $author ? '<div class="testimonial-author">' . $author . '</div>' : '' );
$output.='<div class="testimonial-location">';
if(strlen($customer_city)>1){$output.=$customer_city;}
else{$output.= $city . ', ' . $state;}
$output.='</div>';
$output.= ( $date ? '<div class="testimonial-date">' . $date . '</div>' : '' );
$output.= '</div>';
$output.='</div>';
}
wp_reset_postdata();
}
$output.='</div>';

endif;

return $output;



}


I also used some JavaScript (JQuery) to make a slider to display multiple testimonials on a single page. See below:



/*
* Location Single Page Testimonial Slideshow
* Add slick slider to the testimonial section of the lcoation page
*/
if ($(".testimonial-slideshow").length > 0) {
$(".testimonial-slideshow").slick({
dots: false,
infinite: true,
speed: 300,
fade: false,
cssEase: "ease",
autoplay: true,
autoplaySpeed: 8000,
prevArrow:
'<div class="slick-prev"><i class="fa fa-chevron-left"></i></div>,',
nextArrow:
'<div class="slick-next"><i class="fa fa-chevron-right"></i></div>',
draggable: false,
responsive: [
{
breakpoint: 768,
settings: {
draggable: true
}
}
]
});
}


I tried flushing the rewrite rules in multiple areas for the custom post type but it seemed to have no effect.










share|improve this question

























  • It could be the data in one of the testimonials. Check for error messages both on the server and in the developer console. Try reducing the number of testimonials and increase it by 1 until you find the one that breaks it.

    – aynber
    Nov 21 '18 at 16:36











  • @aynber What type of data do you think could break it? Each testimonial was individually created manually.

    – Blaise
    Nov 21 '18 at 16:40











  • It's really hard to tell. It could be a rogue character or code. If it works with one or two but breaks after a certain amount or certain testimonial, it's usually something within that testimonial that you may have to escape out.

    – aynber
    Nov 21 '18 at 16:42











  • @aynber also what is strange is that when I add a new testimonial. it will display with the shortcode at first but will eventually disappear from view a few page refreshes later.

    – Blaise
    Nov 21 '18 at 16:43














0












0








0








I created a testimonial post type to display reviews I have inputted on my site. then I created two functions to create a testimonial block that would display these reviews on certain pages with a shortcode. At first all was working fine but then as I added more and more testimonials they stopped displaying and I have not been able to figure out why. Does anyone have any experience with this. See the two functions include in my functions.php below:



//Testimonial widget
function sal_testimonials_widget($atts){

//shortcode options
extract(
shortcode_atts(
array(
'section_title' => 'Testimonials',
'custom_location_filter' => '',

), $atts
)
);

//post data
$filter_ids = '';
$post_type = '';

//initial variables
$location_filter = '';


$custom_filters_added = ($custom_location_filter !== '' ? true : false);

if($custom_filters_added){
if($custom_location_filter !== ''){
$filter_ids = $custom_location_filter;
$post_type = 'Locations';
}

}else{
global $post;
$post_type = $post->post_type;
$filter_ids= $post->ID;
}

$output = '<div class="testimonials-block-container">';
$output.= sal_testimonials_block($post_type, true, $filter_ids, $section_title);
$output.= '</div>';
wp_reset_postdata();
return $output;
}

add_shortcode('testimonials_widget', 'sal_testimonials_widget');

////Testimonials block
function sal_testimonials_block($testimonial_type, $enabled, $id, $section_title){
$testimonial_args = array(
'posts_per_page' => $init_amount_to_display,
'offset'=> 0,
'post_type' => 'testimonials',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC'
);

$testimonials_id_array = array();

$testimonials = get_posts( $testimonial_args );
$current_post_id = get_the_ID();
$current_post_type=get_post_type($current_post_ID);
$output.='<div class="testimonial-slideshow">';
if($testimonials):
foreach ($testimonials as $item) {

$location = get_field('location_associated_with_testimonial', $item );
$city= get_field('city', $location);
$state= get_field('state', $location);
$author=get_field('testimonial_authors_name', $item);
$universal=get_field('is_universal', $item);
$date=get_field('testimonial_date', $item);
$customer_city=get_field('customer_city', $item);

if($location==$current_post_id){
$output.='<div class="testimonial-slide">';
$output.= '<div class="testimonial-item">';
$output.= '<q class="testimonial">' . get_post_field('post_content', $item) . '</q>';
$output.= ( $author ? '<div class="testimonial-author">' . $author . '</div>' : '' );

$output.='<div class="testimonial-location">';
if(strlen($customer_city)>1){$output.=$customer_city;}
else{$output.= $city . ', ' . $state;}
$output.='</div>';
$output.= ( $date ? '<div class="testimonial-date">' . $date . '</div>' : '' );
$output.= '</div>';
$output.='</div>';
}
if($testimonial_type!='locations'&&$universal==true){
$output.='<div class="testimonial-slide">';
$output.= '<div class="testimonial-item">';
$output.= '<q class="testimonial">' . get_post_field('post_content', $item) . '</q>';
$output.= ( $author ? '<div class="testimonial-author">' . $author . '</div>' : '' );
$output.='<div class="testimonial-location">';
if(strlen($customer_city)>1){$output.=$customer_city;}
else{$output.= $city . ', ' . $state;}
$output.='</div>';
$output.= ( $date ? '<div class="testimonial-date">' . $date . '</div>' : '' );
$output.= '</div>';
$output.='</div>';
}
wp_reset_postdata();
}
$output.='</div>';

endif;

return $output;



}


I also used some JavaScript (JQuery) to make a slider to display multiple testimonials on a single page. See below:



/*
* Location Single Page Testimonial Slideshow
* Add slick slider to the testimonial section of the lcoation page
*/
if ($(".testimonial-slideshow").length > 0) {
$(".testimonial-slideshow").slick({
dots: false,
infinite: true,
speed: 300,
fade: false,
cssEase: "ease",
autoplay: true,
autoplaySpeed: 8000,
prevArrow:
'<div class="slick-prev"><i class="fa fa-chevron-left"></i></div>,',
nextArrow:
'<div class="slick-next"><i class="fa fa-chevron-right"></i></div>',
draggable: false,
responsive: [
{
breakpoint: 768,
settings: {
draggable: true
}
}
]
});
}


I tried flushing the rewrite rules in multiple areas for the custom post type but it seemed to have no effect.










share|improve this question
















I created a testimonial post type to display reviews I have inputted on my site. then I created two functions to create a testimonial block that would display these reviews on certain pages with a shortcode. At first all was working fine but then as I added more and more testimonials they stopped displaying and I have not been able to figure out why. Does anyone have any experience with this. See the two functions include in my functions.php below:



//Testimonial widget
function sal_testimonials_widget($atts){

//shortcode options
extract(
shortcode_atts(
array(
'section_title' => 'Testimonials',
'custom_location_filter' => '',

), $atts
)
);

//post data
$filter_ids = '';
$post_type = '';

//initial variables
$location_filter = '';


$custom_filters_added = ($custom_location_filter !== '' ? true : false);

if($custom_filters_added){
if($custom_location_filter !== ''){
$filter_ids = $custom_location_filter;
$post_type = 'Locations';
}

}else{
global $post;
$post_type = $post->post_type;
$filter_ids= $post->ID;
}

$output = '<div class="testimonials-block-container">';
$output.= sal_testimonials_block($post_type, true, $filter_ids, $section_title);
$output.= '</div>';
wp_reset_postdata();
return $output;
}

add_shortcode('testimonials_widget', 'sal_testimonials_widget');

////Testimonials block
function sal_testimonials_block($testimonial_type, $enabled, $id, $section_title){
$testimonial_args = array(
'posts_per_page' => $init_amount_to_display,
'offset'=> 0,
'post_type' => 'testimonials',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC'
);

$testimonials_id_array = array();

$testimonials = get_posts( $testimonial_args );
$current_post_id = get_the_ID();
$current_post_type=get_post_type($current_post_ID);
$output.='<div class="testimonial-slideshow">';
if($testimonials):
foreach ($testimonials as $item) {

$location = get_field('location_associated_with_testimonial', $item );
$city= get_field('city', $location);
$state= get_field('state', $location);
$author=get_field('testimonial_authors_name', $item);
$universal=get_field('is_universal', $item);
$date=get_field('testimonial_date', $item);
$customer_city=get_field('customer_city', $item);

if($location==$current_post_id){
$output.='<div class="testimonial-slide">';
$output.= '<div class="testimonial-item">';
$output.= '<q class="testimonial">' . get_post_field('post_content', $item) . '</q>';
$output.= ( $author ? '<div class="testimonial-author">' . $author . '</div>' : '' );

$output.='<div class="testimonial-location">';
if(strlen($customer_city)>1){$output.=$customer_city;}
else{$output.= $city . ', ' . $state;}
$output.='</div>';
$output.= ( $date ? '<div class="testimonial-date">' . $date . '</div>' : '' );
$output.= '</div>';
$output.='</div>';
}
if($testimonial_type!='locations'&&$universal==true){
$output.='<div class="testimonial-slide">';
$output.= '<div class="testimonial-item">';
$output.= '<q class="testimonial">' . get_post_field('post_content', $item) . '</q>';
$output.= ( $author ? '<div class="testimonial-author">' . $author . '</div>' : '' );
$output.='<div class="testimonial-location">';
if(strlen($customer_city)>1){$output.=$customer_city;}
else{$output.= $city . ', ' . $state;}
$output.='</div>';
$output.= ( $date ? '<div class="testimonial-date">' . $date . '</div>' : '' );
$output.= '</div>';
$output.='</div>';
}
wp_reset_postdata();
}
$output.='</div>';

endif;

return $output;



}


I also used some JavaScript (JQuery) to make a slider to display multiple testimonials on a single page. See below:



/*
* Location Single Page Testimonial Slideshow
* Add slick slider to the testimonial section of the lcoation page
*/
if ($(".testimonial-slideshow").length > 0) {
$(".testimonial-slideshow").slick({
dots: false,
infinite: true,
speed: 300,
fade: false,
cssEase: "ease",
autoplay: true,
autoplaySpeed: 8000,
prevArrow:
'<div class="slick-prev"><i class="fa fa-chevron-left"></i></div>,',
nextArrow:
'<div class="slick-next"><i class="fa fa-chevron-right"></i></div>',
draggable: false,
responsive: [
{
breakpoint: 768,
settings: {
draggable: true
}
}
]
});
}


I tried flushing the rewrite rules in multiple areas for the custom post type but it seemed to have no effect.







javascript php jquery wordpress slick.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 17:18







Blaise

















asked Nov 21 '18 at 16:32









BlaiseBlaise

679




679













  • It could be the data in one of the testimonials. Check for error messages both on the server and in the developer console. Try reducing the number of testimonials and increase it by 1 until you find the one that breaks it.

    – aynber
    Nov 21 '18 at 16:36











  • @aynber What type of data do you think could break it? Each testimonial was individually created manually.

    – Blaise
    Nov 21 '18 at 16:40











  • It's really hard to tell. It could be a rogue character or code. If it works with one or two but breaks after a certain amount or certain testimonial, it's usually something within that testimonial that you may have to escape out.

    – aynber
    Nov 21 '18 at 16:42











  • @aynber also what is strange is that when I add a new testimonial. it will display with the shortcode at first but will eventually disappear from view a few page refreshes later.

    – Blaise
    Nov 21 '18 at 16:43



















  • It could be the data in one of the testimonials. Check for error messages both on the server and in the developer console. Try reducing the number of testimonials and increase it by 1 until you find the one that breaks it.

    – aynber
    Nov 21 '18 at 16:36











  • @aynber What type of data do you think could break it? Each testimonial was individually created manually.

    – Blaise
    Nov 21 '18 at 16:40











  • It's really hard to tell. It could be a rogue character or code. If it works with one or two but breaks after a certain amount or certain testimonial, it's usually something within that testimonial that you may have to escape out.

    – aynber
    Nov 21 '18 at 16:42











  • @aynber also what is strange is that when I add a new testimonial. it will display with the shortcode at first but will eventually disappear from view a few page refreshes later.

    – Blaise
    Nov 21 '18 at 16:43

















It could be the data in one of the testimonials. Check for error messages both on the server and in the developer console. Try reducing the number of testimonials and increase it by 1 until you find the one that breaks it.

– aynber
Nov 21 '18 at 16:36





It could be the data in one of the testimonials. Check for error messages both on the server and in the developer console. Try reducing the number of testimonials and increase it by 1 until you find the one that breaks it.

– aynber
Nov 21 '18 at 16:36













@aynber What type of data do you think could break it? Each testimonial was individually created manually.

– Blaise
Nov 21 '18 at 16:40





@aynber What type of data do you think could break it? Each testimonial was individually created manually.

– Blaise
Nov 21 '18 at 16:40













It's really hard to tell. It could be a rogue character or code. If it works with one or two but breaks after a certain amount or certain testimonial, it's usually something within that testimonial that you may have to escape out.

– aynber
Nov 21 '18 at 16:42





It's really hard to tell. It could be a rogue character or code. If it works with one or two but breaks after a certain amount or certain testimonial, it's usually something within that testimonial that you may have to escape out.

– aynber
Nov 21 '18 at 16:42













@aynber also what is strange is that when I add a new testimonial. it will display with the shortcode at first but will eventually disappear from view a few page refreshes later.

– Blaise
Nov 21 '18 at 16:43





@aynber also what is strange is that when I add a new testimonial. it will display with the shortcode at first but will eventually disappear from view a few page refreshes later.

– Blaise
Nov 21 '18 at 16:43












1 Answer
1






active

oldest

votes


















0














I was able to find my main error. In my second PHP function sal_testimonials_block() I had:



 $testimonial_args = array( 
'posts_per_page' => $init_amount_to_display,
'offset'=> 0,
'post_type' => 'testimonials',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC'
);


I realized I never defined $init_amount_to_display, I'm not sure how it was able to work at all originally, but I changed the above block of code to the below and it seems to work fine now.



$testimonial_args = $args = array(
'posts_per_page' => -1,
'post_type' => 'testimonials'
);





share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416589%2fshortcode-no-longer-displaying-custom-post-type%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I was able to find my main error. In my second PHP function sal_testimonials_block() I had:



     $testimonial_args = array( 
    'posts_per_page' => $init_amount_to_display,
    'offset'=> 0,
    'post_type' => 'testimonials',
    'post_status' => 'publish',
    'orderby' => 'date',
    'order' => 'DESC'
    );


    I realized I never defined $init_amount_to_display, I'm not sure how it was able to work at all originally, but I changed the above block of code to the below and it seems to work fine now.



    $testimonial_args = $args = array(
    'posts_per_page' => -1,
    'post_type' => 'testimonials'
    );





    share|improve this answer






























      0














      I was able to find my main error. In my second PHP function sal_testimonials_block() I had:



       $testimonial_args = array( 
      'posts_per_page' => $init_amount_to_display,
      'offset'=> 0,
      'post_type' => 'testimonials',
      'post_status' => 'publish',
      'orderby' => 'date',
      'order' => 'DESC'
      );


      I realized I never defined $init_amount_to_display, I'm not sure how it was able to work at all originally, but I changed the above block of code to the below and it seems to work fine now.



      $testimonial_args = $args = array(
      'posts_per_page' => -1,
      'post_type' => 'testimonials'
      );





      share|improve this answer




























        0












        0








        0







        I was able to find my main error. In my second PHP function sal_testimonials_block() I had:



         $testimonial_args = array( 
        'posts_per_page' => $init_amount_to_display,
        'offset'=> 0,
        'post_type' => 'testimonials',
        'post_status' => 'publish',
        'orderby' => 'date',
        'order' => 'DESC'
        );


        I realized I never defined $init_amount_to_display, I'm not sure how it was able to work at all originally, but I changed the above block of code to the below and it seems to work fine now.



        $testimonial_args = $args = array(
        'posts_per_page' => -1,
        'post_type' => 'testimonials'
        );





        share|improve this answer















        I was able to find my main error. In my second PHP function sal_testimonials_block() I had:



         $testimonial_args = array( 
        'posts_per_page' => $init_amount_to_display,
        'offset'=> 0,
        'post_type' => 'testimonials',
        'post_status' => 'publish',
        'orderby' => 'date',
        'order' => 'DESC'
        );


        I realized I never defined $init_amount_to_display, I'm not sure how it was able to work at all originally, but I changed the above block of code to the below and it seems to work fine now.



        $testimonial_args = $args = array(
        'posts_per_page' => -1,
        'post_type' => 'testimonials'
        );






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 22 '18 at 3:48

























        answered Nov 21 '18 at 19:07









        BlaiseBlaise

        679




        679






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416589%2fshortcode-no-longer-displaying-custom-post-type%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Paul Cézanne

            UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

            Angular material date-picker (MatDatepicker) auto completes the date on focus out