Support » Plugin: WordPress Ajax Load More and Infinite Scroll » post not found message for each loop

  • namisukichin69

    (@namisukichin69)


    Hi,

    I used the hook ‘cpt_alm_post_not_found’ to change the ‘post not found’ message for my custom loop. but the parameter ‘$id’ in your code (here: https://plugins.blacktheme.net/cpt-ajax-load-more/docs/filters/#cpt_alm_post_not_found) returns ‘Post not found’ message when echoed.

    How to change the ‘Post not found’ message for each loop?

    my code:

    function change_the_ajax_loop_not_found_text($id){
    	return '<p style="padding-left: 10px">Nothing found.'.$id.'</p>';
    }
    
    add_filter( 'cpt_alm_post_not_found', 'change_the_ajax_loop_not_found_text', 10, 1);

    Regards,
    Nami

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter namisukichin69

    (@namisukichin69)

    I fixed it by editing the file includes/class-cpt-alm-shortcodes.php

    Line 155:

    $html .= apply_filters('cpt_alm_post_not_found', 'Post not found');

    to

    $html .= apply_filters('cpt_alm_post_not_found', 'Post not found', $cpt_alm_id);

    add added 2 arguments at add_filter:

    function change_the_ajax_loop_not_found_text($default_text, $id){
    	if($id == 'custom-id'){
             return 'something else not found';
             } else {
              return '<p style="padding-left: 10px">Nothing found.</p>';
            }
    }
    
    add_filter( 'cpt_alm_post_not_found', 'change_the_ajax_loop_not_found_text', 10, 2); //--2 args

    Please let me know if there is a better fix or the plugin file must be updated?

Viewing 1 replies (of 1 total)
  • The topic ‘post not found message for each loop’ is closed to new replies.