reduxframework / redux-framework

Redux is a simple, truly extensible options framework for WordPress themes and plugins!

Home Page:http://redux.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Repeater not Working in Custom Post Type

imadeelnazar opened this issue · comments

Hi There,

I am Theme Developer, I am using Repeater in Custom Post type and Page some reason repeater just showing static fields on custom post type but on theme options repeater working perfectly fine.

Any help would be great.

Thank You

Site Health Report

Steps to reproduce

Expected Behavior

Actual Behavior

Any Error Details (PHP/JavaScript)

Problem one. All of the requested information was left blank. You'll need to go back, read the instructions provided, and post that information. "It doesn't work, why?" tells me nothing. https://raw.githubusercontent.com/reduxframework/redux-framework/master/.github/ISSUE_TEMPLATE/dev.md

BUG REPORT

Health Report
https://nimb.ws/nO3RMP
https://nimb.ws/ClkxqM

Code I am using to add repeater
https://ibb.co/3Wc0qW6

Theme Option - Customizer (Working Fine here)
https://nimb.ws/pwJbAH

On Custom Post Type (Not working)
https://ibb.co/x8jGgs9

array(
    "id"          => "opt-event-simple-layout-one-field",
    "type"        => "repeater",
    "title"       => esc_html__( "Repeater", "your-textdomain-here" ),
    "subtitle"    => esc_html__( "Repeater", "your-textdomain-here" ),

    "fields"      => array(
        array(
            "id"          => "title_field",
            "type"        => "text",
            "placeholder" => esc_html__( "Title", "your-textdomain-here" ),
        ),

    ),
),

Call this code in Custom Post type inside 'Redux_Metaboxes::set_box('

repeater-code
repeater-visual-area

I just want to use repeater in Custom Post type Meta box.

I have followed the template best of my knowledge let me know if there is anything else missing.

Thank You

Did you check the console log or error logs for errors? I am unable to recreate this issue. Please post your theme so I can download it and take a look without all the guesswork. Thanks.

Hi Kevin,

I have created a small video i hope it will explain what actually i am facing.

https://share.vidyard.com/watch/JzQd1zuca6vrcswi1qVaaa?
You need to install the plugin after installing the Redux Framework Plugin and activate any WordPress default theme.

Here is the Redux Plugin i am developing for the Theme Options and Custom FIelds.
https://drive.google.com/file/d/1OKlXjaK5XelCZDBYgXtZr5YbTe2pfrAJ/view?usp=sharing

Thank You

Your metabox config was incorrect. Here is how it should look.

<?php

defined( 'ABSPATH' ) || exit;

if ( ! class_exists( 'Redux_Metaboxes' ) ) {
	return;
}
Redux_Metaboxes::set_box(
	$redux_testing_opt,
	array(
		'id'         => 'opt-event-simple-layout-one-section',
		'title'      => esc_html__( 'Simple Repeater With One Field', 'your-textdomain-here' ),
		'post_types' => array( 'post' ),
		'position'   => 'normal', // normal, advanced, side.
		'priority'   => 'high', // high, core, default, low.
		'sections'   => array(
			array(
				'fields' => array(
					array(
						'id'       => 'opt-event-simple-layout-one-field',
						'type'     => 'repeater',
						'title'    => esc_html__( 'Repeater', 'your-textdomain-here' ),
						'subtitle' => esc_html__( 'Repeater', 'your-textdomain-here' ),
						'fields'   => array(
							array(
								'id'          => 'title_field',
								'type'        => 'text',
								'placeholder' => esc_html__( 'Title', 'your-textdomain-here' ),
							),

						),
					),
				),
			),
		),
	)
);

For additional information how on to use metaboxes and configs, see here: https://devs.redux.io/core-extensions/metaboxes.html#example-config

Good luck.