Advertisement
arie_cristianD

temp add jnews faq on wpbakery

Jul 1st, 2025
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.54 KB | None | 0 0
  1. add_action(
  2.     'vc_before_init',
  3.     function () {
  4.         vc_map(
  5.             array(
  6.                 'name'     => esc_html__( 'JNews FAQ', 'jnews' ),
  7.                 'base'     => 'custom_jnews_faq',
  8.                 'category' => esc_html__( 'JNews', 'jnews' ),
  9.                 'icon'     => 'vc_icon-vc-accordion',
  10.                 'params'   => array(
  11.                     array(
  12.                         'type'        => 'param_group',
  13.                         'heading'     => esc_html__( 'FAQ Lists', 'jnews' ),
  14.                         'param_name'  => 'faqLists',
  15.                         'description' => esc_html__( "List of FAQ item's.", 'jnews' ),
  16.                         'params'      => array(
  17.                             array(
  18.                                 'type'        => 'textarea',
  19.                                 'heading'     => esc_html__( 'Question', 'jnews' ),
  20.                                 'param_name'  => 'question',
  21.                                 'description' => esc_html__( 'Insert your FAQ Question.', 'jnews' ),
  22.                             ),
  23.                             array(
  24.                                 'type'        => 'textarea_html',
  25.                                 'heading'     => esc_html__( 'Answer', 'jnews' ),
  26.                                 'param_name'  => 'answer',
  27.                                 'description' => esc_html__( 'Insert your FAQ Answer.', 'jnews' ),
  28.                             ),
  29.                         ),
  30.                         'value'       => urlencode(
  31.                             json_encode(
  32.                                 array(
  33.                                     array(
  34.                                         'question' => 'Lorem ipsum dolor sit amet',
  35.                                         'answer'   => 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit...',
  36.                                     ),
  37.                                     array(
  38.                                         'question' => 'Far far away, behind the word mountains',
  39.                                         'answer'   => 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit...',
  40.                                     ),
  41.                                     array(
  42.                                         'question' => 'The quick, brown fox jumps over a lazy dog',
  43.                                         'answer'   => 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit...',
  44.                                     ),
  45.                                 )
  46.                             )
  47.                         ),
  48.                     ),
  49.                     array(
  50.                         'type'        => 'checkbox',
  51.                         'heading'     => esc_html__( 'Hide on Frontend', 'jnews' ),
  52.                         'param_name'  => 'hideFrontend',
  53.                         'description' => esc_html__( 'Enable this option if you only want to display this FAQ on FAQs Page Schema.', 'jnews' ),
  54.                     ),
  55.                     array(
  56.                         'type'        => 'dropdown',
  57.                         'heading'     => esc_html__( 'Style', 'jnews' ),
  58.                         'param_name'  => 'faqStyle',
  59.                         'value'       => array(
  60.                             esc_html__( 'Style 1', 'jnews' ) => 'style-1',
  61.                             esc_html__( 'Style 2', 'jnews' ) => 'style-2',
  62.                             esc_html__( 'Style 3', 'jnews' ) => 'style-3',
  63.                             esc_html__( 'Style 4', 'jnews' ) => 'style-4',
  64.                             esc_html__( 'Style 5', 'jnews' ) => 'style-5',
  65.                         ),
  66.                         'description' => esc_html__( 'Choose your FAQ style.', 'jnews' ),
  67.                     ),
  68.                     array(
  69.                         'type'       => 'colorpicker',
  70.                         'heading'    => esc_html__( 'Question Color', 'jnews' ),
  71.                         'param_name' => 'questionColor',
  72.                     ),
  73.                     array(
  74.                         'type'       => 'colorpicker',
  75.                         'heading'    => esc_html__( 'Answer Color', 'jnews' ),
  76.                         'param_name' => 'answerColor',
  77.                     ),
  78.                     array(
  79.                         'type'       => 'colorpicker',
  80.                         'heading'    => esc_html__( 'Icon Color', 'jnews' ),
  81.                         'param_name' => 'iconColor',
  82.                     ),
  83.                     array(
  84.                         'type'       => 'colorpicker',
  85.                         'heading'    => esc_html__( 'Background Color', 'jnews' ),
  86.                         'param_name' => 'faqBackground',
  87.                     ),
  88.                     array(
  89.                         'type'       => 'colorpicker',
  90.                         'heading'    => esc_html__( 'Border Color', 'jnews' ),
  91.                         'param_name' => 'faqBorder',
  92.                     ),
  93.                 ),
  94.             )
  95.         );
  96.     }
  97. );
  98.  
  99.  
  100. add_shortcode( 'custom_jnews_faq', 'render_jnews_faq' );
  101. function render_jnews_faq( $atts, $content = null ) {
  102.  
  103.     error_log( 'custom_jnews_faq--------' );
  104.     error_log( print_r( $atts, true ) );
  105.  
  106.     return '';
  107.     // Parse atts, param group json decode, generate HTML output
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement