• Resolved pavlito

    (@pavlito)


    Hi support,

    I have problem with updating. Text does not output updated text, instead displays old text?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    What text are you referring to? If it’s anything outside of our CPTUI plugin settings area, then I’m not going to be the best place to ask for help there. If it’s one of the labels for a post type/taxonomy, for example, then I would be the person to talk to.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Any changes or updates with this one @pavlito?

    Thread Starter pavlito

    (@pavlito)

    Hi @michael , sry for delayed reply.

    Yes the problem is solved. It is stupid mistake done by my colleague. He added 2 same post but with different categories. I was trying to change 1 post, and whatever I change output remains the same (apparently it was second post). Then i spend 2 hours on modifying my custom query ??

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Gotcha, makes sense.

    Glad to hear it got resolved.

    Thread Starter pavlito

    (@pavlito)

    Yep. But Another problem comes in….

    I have register new sidebar and create new widget in order to display list of custom posts.
    The widget displays only 10 posts (i have 17), and I did not set any limitation in wp_query…

    Help?

    class AllVideosWidget extends WP_Widget {
    
        function __construct() {
            // Instantiate the parent object
            parent::__construct( false, 'All Videos Widget' );
        }
    
            // Widget output
            $args = array(
            'post_type' => 'video',
            'post_status' => 'publish',
            'category_name' => $a['category_name']
        );
      
        $query = new WP_Query($args);
        if ($query->have_posts()) {
            $string = '';
            $counter = 0;
            $video_list = array (
                    'video_title' => '',
                    'video_description' => '',
                    'video_url' => ''
                );
    
            while ($query->have_posts()) {
                $query->the_post();
    
                $video_title = get_field('video_title');
                $video_description = get_field('video_description');
                $video_url = get_field('video_url');
                str_replace("watch?v=", "embed/",  $video_url);
    
                $video_list["video_title"][] = $video_title;
                $video_list["video_description"][] = $video_description;
                $video_list["video_url"][] = $video_url;
               	
                $counter++;
            }// end while
        } // end if have post
        
        wp_reset_postdata();
        $html = "<div class='widget widget_box_slide'>";
        $html.='<h4 class="widget-title">All videos</h4>';
    
        $html.='<div class="textwidget"><p>';
        for ($i=0; $i < $counter ; $i++) { 
            $html.= "<a href=" 
            . $video_list["video_url"][$i] .">" 
            . $video_list["video_title"][$i] . "</a><br>";
        }
    
        $html.='</p></div>';
        $html.= "</div>";
        echo $html;
    
        }
    
        function update( $new_instance, $old_instance ) {
            // Save widget options
        }
    
        function form( $instance ) {
            // Output admin widget options form
        }
    }
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    That’s because the default amount is 10, and you’re not providing any sort of pagination.

    https://codex.www.ads-software.com/Class_Reference/WP_Query#Pagination_Parameters

    Thread Starter pavlito

    (@pavlito)

    Hi @michael,

    Thank you on this instruction. It helped me ??

    post_per_page => -1

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Not updating text’ is closed to new replies.