Thursday, July 14, 2022
HomeWordPress DevelopmentFind out how to create submit favourite operate with out plugins

Find out how to create submit favourite operate with out plugins


I am creating a lesson plan plugin … and inside this lesson plans you’ll have the choice to favourite which plans customers like, I am itemizing the registered plans that is very simple utilizing as a shortcode like this under, however I’ve already regarded for it till proper right here how you can do it with out utilizing a plugin, however at all times ending up returned to put in …. when you will help with examples or content material it will assist rather a lot, and I am sorry for the unhealthy writing in Englishenter image description here

Right here is the code the place I listing the lesson plans

 operate lesson_plans(){

    $cale_plan_post = [
        'post_type'      => 'cale-plan',
        'post_status'    => 'publish',
       
    ];
    
   $cale_plan_posts  = new WP_Query( $cale_plan_post);
    whereas (  $cale_plan_posts->have_posts() ) :  
        $cale_plan_posts->the_post(); 
        echo'<div>
                <div class="">
                    <h2>'; echo the_title().'</h2>';
                    echo the_content().'
                    <a href="https://wordpress.stackexchange.com/questions/407633/; echo the_permalink ().">zz</a>
                </div>
                
                <a  data-post-id="';echo $cale_plan_posts->post->ID. '">♥ Add to favorites</a>
            </div>';
          
       
    endwhile;
    wp_reset_postdata();
}

if ( class_exists( 'Cale_discourse' ) ) {
    register_activation_hook( __FILE__, [ 'Cale_discourse', 'activate' ] );
    register_deactivation_hook( __FILE__, [ 'Cale_discourse', 'deactivate' ] );
    register_uninstall_hook( __FILE__, [ 'Cale_discourse', 'uninstall' ] );
    add_shortcode( 'list_plans' ,'lesson_plans');
  
    $cale_discourse = new GlobalCale_discourse();     
    
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments