| 1 |
<?php |
| 2 |
// Select docs page |
| 3 |
$args = array( |
| 4 |
'post_type' => 'topic', |
| 5 |
'posts_per_page' => 1, |
| 6 |
'orderby' => 'menu_order', |
| 7 |
'order' => 'desc' |
| 8 |
); |
| 9 |
|
| 10 |
$topic_permalink = ''; |
| 11 |
foreach ( get_posts( $args ) as $post ) { |
| 12 |
$topic_permalink = get_permalink( $post->ID ); |
| 13 |
} |
| 14 |
|
| 15 |
$forum_url = admin_url('customize.php?url=') . site_url( '/' ) . get_option( '_bbp_root_slug' ) . '?autofocus[panel]=bbp-core-settings&autofocus[section]=forum-archive-page'; |
| 16 |
$topic_url = admin_url( 'customize.php?url=' ) . $topic_permalink . '?autofocus[panel]=bbp-core-settings&autofocus[section]=topics_fields'; |
| 17 |
|
| 18 |
// Create a section. |
| 19 |
CSF::createSection( |
| 20 |
$prefix, |
| 21 |
[ |
| 22 |
'title' => __( 'General', 'bbp-core' ), |
| 23 |
'icon' => 'dashicons dashicons-admin-generic', |
| 24 |
'fields' => [ |
| 25 |
[ |
| 26 |
'id' => 'bbpc_brand_color', |
| 27 |
'type' => 'color', |
| 28 |
'title' => esc_html__( 'Frontend Brand Color', 'bbp-core' ), |
| 29 |
'output' => ':root', |
| 30 |
'output_mode' => '--bbpc_brand_color_opt', |
| 31 |
], |
| 32 |
|
| 33 |
[ |
| 34 |
'id' => 'customizer_visibility', |
| 35 |
'type' => 'switcher', |
| 36 |
'title' => esc_html__( 'Options Visibility on Customizer', 'bbp-core' ), |
| 37 |
'text_on' => esc_html__( 'Enabled', 'bbp-core' ), |
| 38 |
'text_off' => esc_html__( 'Disabled', 'bbp-core' ), |
| 39 |
'text_width' => 100 |
| 40 |
], |
| 41 |
|
| 42 |
[ |
| 43 |
'type' => 'content', |
| 44 |
'title' => esc_html__( 'Customizer Options', 'bbp-core' ), |
| 45 |
'content' => '<a href="' . esc_url( $forum_url ) . '" target="_blank" id="bbpc_forum_option_link">' . esc_html__( 'Forum', 'bbp-core' ) |
| 46 |
. '</a> ' . '<a href="' . esc_url( $topic_url ) . '" target="_blank" id="bbpc_topic_option_link">' . esc_html__( 'Topic', |
| 47 |
'bbp-core' ) . '</a>', |
| 48 |
'dependency' => [ |
| 49 |
[ 'customizer_visibility', '==', true ], |
| 50 |
], |
| 51 |
] |
| 52 |
] |
| 53 |
] |
| 54 |
); |
| 55 |
|