Plugin Directory

Changeset 2785633


Ignore:
Timestamp:
09/15/2022 11:50:16 PM (3 years ago)
Author:
rajd76816
Message:

Bug Fixed issue #

Location:
product-testimonial/trunk/inc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • product-testimonial/trunk/inc/dynamic-css.php

    r2785480 r2785633  
    11<?php
    22/*
    3 *   Add Meta Box
     3*   Dynamic Css value
    44*/
    5 function cwpt_meta_box() {
    6     add_meta_box(
    7         'cwpt-meta-box-id',
    8         esc_html__( 'CWPT MetaBox', 'cwpt' ),
    9         'cwpt_meta_box_callback',
    10         ('cwpt')
    11     );
     5function add_dynamic_css_cwpt() { ?>
     6    <style type="text/css" media="all">
     7        .testimonial .name{
     8            color: <?php $rating_bg_color = get_option( 'rating-color-option', true ); if(!empty($rating_bg_color)) {echo esc_attr( $rating_bg_color );} else {echo _e( "#EABD44" );}?>;
     9        }
     10    .testimonial .title, .testimonial .post{
     11     color: <?php $color_theme = get_option( 'title-color-option', true ); if(!empty($color_theme)) { echo esc_attr( $color_theme );} else {echo _e( "#EABD44" );}?>;
     12
     13    }
     14    .testimonial .testimonial-content:after, .testimonial:hover .pic, .owl-theme .owl-controls .owl-buttons div:hover{
     15     background: <?php $hover_color = get_option( 'hover-color-option', true ); if(!empty($hover_color)) { echo esc_attr( $hover_color ); } else {echo _e( "#1d3033" ); }?>;
     16
     17    } 
     18    .testimonial .rating{
     19     background: <?php $rating_bg_color = get_option( 'rating-color-option', true ); if(!empty($rating_bg_color)) {echo esc_attr( $rating_bg_color );} else {echo _e( "#EABD44" );}?>;
     20
     21    }
     22    .testimonial .rating li{
     23     color: <?php $color_theme = get_option( 'title-color-option', true ); if(!empty($color_theme)) {echo esc_attr( $color_theme );} else {echo _e( "#EABD44" );}?>;
     24
     25    }
     26 </style>
     27<?php
    1228}
    13 add_action( 'admin_menu', 'cwpt_meta_box' );
    14 
    15 function cwpt_meta_box_callback($post){
    16     $cwpt_get_name        = get_post_meta( get_the_ID(), 'testmonial_name', true );
    17     $cwpt_get_designation = get_post_meta( get_the_ID(), 'test_designation', true );
    18     $cwpt_get_rating      = get_post_meta( get_the_ID(), 'testmonial_rating', true );
    19     ?>
    20     <label><?php echo esc_attr('Testimonial Name', 'cwpt') ?></label>
    21     <input style= width:15%; type="text" name="testmonial_name" id="testmonial_name" value="<?php echo esc_attr($cwpt_get_name ); ?>">
    22     <label><?php echo esc_attr('Testimonial Designation', 'cwpt') ?></label>
    23     <input style= width:15%; type="text" name="test_designation" id="test_designation" value="<?php echo esc_attr($cwpt_get_designation ); ?>">
    24     <label><?php echo esc_attr('Testimonial Rating', 'cwpt') ?></label>
    25     <input style= width:10%; type="text" name="testmonial_rating" id="testmonial_rating" value="<?php echo esc_attr( $cwpt_get_rating ); ?>">
    26     <?php
    27 }
    28 function cwpt_post_save($post_id){
    29     $set_name = isset($_POST['testmonial_name'])? sanitize_text_field( $_POST['testmonial_name']) : '';
    30     $set_designation = isset($_POST['test_designation'])? sanitize_text_field( $_POST['test_designation']): '';
    31     $set_rating = isset($_POST['testmonial_rating'])? sanitize_text_field( $_POST['testmonial_rating']): '';
    32 
    33     update_post_meta( get_the_ID(), 'testmonial_name',  $set_name);
    34     update_post_meta( get_the_ID(), 'test_designation',  $set_designation);
    35     update_post_meta( get_the_ID(), 'testmonial_rating',  $set_rating);
    36 
    37     /*$sanitize_testi_name = sanitize_text_field( $_POST['testmonial_name']);
    38     $sanitize_testi_desig = sanitize_text_field( $_POST['test_designation']);
    39     $sanitize_testi_rating = sanitize_text_field( $_POST['testmonial_rating']);*/
    40 }
    41 add_action('save_post', 'cwpt_post_save');
     29add_action( 'wp_head', 'add_dynamic_css_cwpt' );
  • product-testimonial/trunk/inc/metabox.php

    r2785480 r2785633  
    11<?php
    2 /**
    3  *
    4  * Add a submenu page under a custom post type parent.
    5  * 
    6  */
    7 function cwpt_register_ref_page() {
    8     add_submenu_page(
    9          'edit.php?post_type=cwpt',
    10         __( 'Settings', 'cwpt' ),
    11         __( 'Settings', 'cwpt' ),
    12         'manage_options',
    13         'cwpt-setting-page',
    14         'cwpt_callback_func'
    15     );
     2/*
     3*   Add Meta Box
     4*/
     5function cwpt_meta_box() {
     6    add_meta_box(
     7        'cwpt-meta-box-id',
     8        esc_html__( 'CWPT MetaBox', 'cwpt' ),
     9        'cwpt_meta_box_callback',
     10        ('cwpt')
     11    );
    1612}
    17  add_action('admin_menu', 'cwpt_register_ref_page');
    18 /**
    19  * Display callback for the submenu page.
    20  */
    21 function cwpt_callback_func() {
     13add_action( 'admin_menu', 'cwpt_meta_box' );
     14
     15function cwpt_meta_box_callback($post){
     16    $cwpt_get_name        = get_post_meta( get_the_ID(), 'testmonial_name', true );
     17    $cwpt_get_designation = get_post_meta( get_the_ID(), 'test_designation', true );
     18    $cwpt_get_rating      = get_post_meta( get_the_ID(), 'testmonial_rating', true );
    2219    ?>
    23     <div class="wrap">
    24         <div class="card card-second">
    25             <div class="card-body">
    26                 <div class="clrFix"></div>
    27                 <h3><?php _e( 'About the Author', 'cwpt' ) ?></h3>
    28                 <p>My Development Skill:
    29                     <li>Design or customize any type of wordpress cms for exm: a Blog, E-Commerce, Personal site.</li>
    30                     <li>Develop Wordpress Simple Plugin.</li>
    31                     <li>Can assurance qualities of any type of Wordpress plugins or wordpress Theme.</li>
    32                     <li>I have already written a lot of content for the WordPress blog so I have fully experience about it. </li>
    33                     <a href="https://www.linkedin.com/in/sadekur-rahman-b06208165/">If You Hire</a>.<br />
    34                     <strong>Twetter:</strong> <a href="https://twitter.com/rahman_shadekur">Sadekur Rahman</a><br />
    35                     <strong>Skype:</strong> sadekur.rahman1<br />
    36                     <strong>Email:</strong> [email protected]<br/>
    37                    
    38                     <strong>Hire Me on:</strong> <a href="https://www.linkedin.com/in/sadekur-rahman-b06208165/" target="_blank">Linkedin</a><br />
    39                     <div class="clrFix"></div>
    40                 </div>
    41             </div>
    42             <h1>
    43                 <?php echo esc_attr(__('Testimonial Settings')); ?>
    44             </h1>
    45             <div class="card">
    46                 <div class="card-body">
    47                     <form action="" id="pt_form" class="" method="POST">
    48                         <div class="main-form mt-3 border-bottom">
    49                             <input type="hidden" name="action" value="action-value">
    50                             <?php
    51                             $get_title_color_option = get_option( 'title-color-option', true );
    52                             $get_hover_color_option = get_option( 'hover-color-option', true );
    53                             $get_rating_color_option = get_option( 'rating-color-option', true );
    54                             ?>
    55                             <div class="form-group">
    56                                 <label for=""><?php echo esc_attr(__('Title Color:')); ?></label>
    57                                 <input type="text" name="title_color" value="<?php echo esc_attr($get_title_color_option); ?>" class="color-picker" placeholder="Enter Color">
    58                                 <label for=""><?php echo esc_attr(__('Hover Color:')); ?></label>
    59                                 <input type="color" name="hover_color" value="<?php echo esc_attr($get_hover_color_option); ?>" class="" placeholder="Enter Color">
    60                                 <label for=""><?php echo esc_attr(__('Rating Color:')); ?></label>
    61                                 <input type="color" name="rating_color" value="<?php echo esc_attr($get_rating_color_option); ?>" class="rating-color" placeholder="Rating Color">
     20    <label><?php echo esc_attr('Testimonial Name', 'cwpt') ?></label>
     21    <input style= width:15%; type="text" name="testmonial_name" id="testmonial_name" value="<?php echo esc_attr($cwpt_get_name ); ?>">
     22    <label><?php echo esc_attr('Testimonial Designation', 'cwpt') ?></label>
     23    <input style= width:15%; type="text" name="test_designation" id="test_designation" value="<?php echo esc_attr($cwpt_get_designation ); ?>">
     24    <label><?php echo esc_attr('Testimonial Rating', 'cwpt') ?></label>
     25    <input style= width:10%; type="text" name="testmonial_rating" id="testmonial_rating" value="<?php echo esc_attr( $cwpt_get_rating ); ?>">
     26    <?php
     27}
     28function cwpt_post_save($post_id){
     29    $set_name = isset($_POST['testmonial_name'])? sanitize_text_field( $_POST['testmonial_name']) : '';
     30    $set_designation = isset($_POST['test_designation'])? sanitize_text_field( $_POST['test_designation']): '';
     31    $set_rating = isset($_POST['testmonial_rating'])? sanitize_text_field( $_POST['testmonial_rating']): '';
    6232
    63                             </div>
    64                             <div class="paste-new-forms"></div>
    65                             <!-- <input type="submit" value="<?php _e('Save Change', 'pt'); ?>"> -->
    66                             <?php
    67                             submit_button();
    68                             ?>
    69                         </form>
    70                     </div>
    71                 </div>
    72             </div>
    73         </div>
    74         <?php
    75     }
    76 function cwpt_ajax_val() {
    77     /*$title_color  = isset( $_POST['title_color'] )? $_POST['title_color']: '';
    78     $hover_color    = isset( $_POST['hover_color'] )? $_POST['hover_color']: '';*/
     33    update_post_meta( get_the_ID(), 'testmonial_name',  $set_name);
     34    update_post_meta( get_the_ID(), 'test_designation',  $set_designation);
     35    update_post_meta( get_the_ID(), 'testmonial_rating',  $set_rating);
    7936
    80     $sanitize_title_color = sanitize_text_field( $_POST['title_color']);
    81     $sanitize_hover_color = sanitize_text_field( $_POST['hover_color']);
    82     $rating_color         = sanitize_text_field( $_POST['rating_color']);
    83 
    84     update_option( 'title-color-option', $sanitize_title_color );
    85     update_option( 'hover-color-option', $sanitize_hover_color );
    86     update_option( 'rating-color-option', $rating_color );
    87     wp_send_json( "Data Saved" );
    88 }
    89 add_action( 'wp_ajax_action-value', 'cwpt_ajax_val' );
    90 
    91     /*
    92     *   Get all options value
    93     */
    94 $get_title_color_option  = get_option( 'title-color-option', true );
    95 $get_hover_color_option  = get_option( 'hover-color-option', true );
    96 $get_rating_color_option = get_option( 'rating-color-option', true );
    97 
    98 
     37    /*$sanitize_testi_name = sanitize_text_field( $_POST['testmonial_name']);
     38    $sanitize_testi_desig = sanitize_text_field( $_POST['test_designation']);
     39    $sanitize_testi_rating = sanitize_text_field( $_POST['testmonial_rating']);*/
     40}
     41add_action('save_post', 'cwpt_post_save');
Note: See TracChangeset for help on using the changeset viewer.