| 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]=forumax-settings&autofocus[section]=forum-archive-page'; |
| 16 |
$topic_url = admin_url('customize.php?url=') . $topic_permalink . '?autofocus[panel]=forumax-settings&autofocus[section]=topics_fields'; |
| 17 |
|
| 18 |
// Create a section. |
| 19 |
CSF::createSection( |
| 20 |
$prefix, |
| 21 |
[ |
| 22 |
'title' => __('General', 'forumax'), |
| 23 |
'icon' => 'dashicons dashicons-admin-generic', |
| 24 |
'fields' => [ |
| 25 |
[ |
| 26 |
'id' => 'bbpc_brand_color', |
| 27 |
'type' => 'color', |
| 28 |
'title' => esc_html__('Frontend Brand Color', 'forumax'), |
| 29 |
'subtitle' => esc_html__('Choose a primary color to style the frontend appearance of your forum.', 'forumax'), |
| 30 |
'output' => ':root', |
| 31 |
'output_mode' => '--bbpc_brand_color_opt', |
| 32 |
], |
| 33 |
|
| 34 |
[ |
| 35 |
'id' => 'sidebar_position', |
| 36 |
'type' => 'button_set', |
| 37 |
'title' => esc_html__('Sidebar Position', 'forumax'), |
| 38 |
'subtitle' => esc_html__('Set the default position for the forum sidebar on topic and archive pages.', 'forumax'), |
| 39 |
'options' => [ |
| 40 |
'left' => esc_html__('Left', 'forumax'), |
| 41 |
'right' => esc_html__('Right', 'forumax'), |
| 42 |
], |
| 43 |
'default' => 'left', |
| 44 |
], |
| 45 |
|
| 46 |
[ |
| 47 |
'id' => 'customizer_visibility', |
| 48 |
'type' => 'switcher', |
| 49 |
'title' => esc_html__('Options Visibility on Customizer', 'forumax'), |
| 50 |
'subtitle' => esc_html__('Enable this to configure and preview forum styling options inside the WordPress Customizer.', 'forumax'), |
| 51 |
'text_on' => esc_html__('Enabled', 'forumax'), |
| 52 |
'text_off' => esc_html__('Disabled', 'forumax'), |
| 53 |
'text_width' => 100 |
| 54 |
], |
| 55 |
|
| 56 |
[ |
| 57 |
'type' => 'content', |
| 58 |
'title' => esc_html__('Customizer Options', 'forumax'), |
| 59 |
'subtitle' => esc_html__('Access the real-time customizer to configure specific layout and styling options for your forum.', 'forumax'), |
| 60 |
'content' => '<a href="' . esc_url($forum_url) . '" target="_blank" id="bbpc_forum_option_link">' . esc_html__('Forum', 'forumax') |
| 61 |
. '</a> ' . '<a href="' . esc_url($topic_url) . '" target="_blank" id="bbpc_topic_option_link">' . esc_html__( |
| 62 |
'Topic', |
| 63 |
'forumax' |
| 64 |
) . '</a>', |
| 65 |
'dependency' => [ |
| 66 |
['customizer_visibility', '==', true], |
| 67 |
], |
| 68 |
] |
| 69 |
] |
| 70 |
] |
| 71 |
); |
| 72 |
|