How to create post favorite function without plugins


I’m developing a lesson plan plugin … and within this lesson plans you will have the option to favorite which plans users like, I’m listing the registered plans this is very easy using as a shortcode like this below, but I’ve already looked for it until right here how to do it without using a plugin, but always ending up returned to install …. if you can help with examples or content it would help a lot, and I’m sorry for the bad writing in Englishenter image description here

Here is the code where I list the lesson plans

 function lesson_plans(){

    $cale_plan_post = [
        'post_type'      => 'cale-plan',
        'post_status'    => 'publish',
   $cale_plan_posts  = new WP_Query( $cale_plan_post);
    while (  $cale_plan_posts->have_posts() ) :  
                <div class="">
                    <h2>'; echo the_title().'</h2>';
                    echo the_content().'
                    <a href="; echo the_permalink ().">zz</a>
                <a  data-post-id="';echo $cale_plan_posts->post->ID. '">♥ Add to favorites</a>

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();     

fuxia 5 months 2022-07-13T16:12:14-05:00 0 Answers 0 views 0

Leave an answer