| 1 |
<?php |
| 2 |
// Exit if accessed directly |
| 3 |
if( !defined( 'ABSPATH' ) ) exit; |
| 4 |
if( !current_user_can('administrator') ) exit; |
| 5 |
?> |
| 6 |
|
| 7 |
<div id="wpf-admin-wrap" class="wrap wpforo-themes"> |
| 8 |
<h2 style="padding:20px 0px 0px 0px;line-height: 20px;"> |
| 9 |
<?php _e('Forum Themes', 'wpforo'); ?> |
| 10 |
<a href="<?php echo admin_url( 'admin.php?page=wpforo-themes&action=add' ) ?>" class="add-new-h2" style="margin-left:10px; display:none;"><?php _e('Add New', 'wpforo'); ?></a> |
| 11 |
</h2> |
| 12 |
<?php $wpforo->notice->show(FALSE) ?> |
| 13 |
|
| 14 |
<div style="box-shadow:none; margin:25px 0px 20px 0px;" class="wpf-info-bar"> |
| 15 |
<p style="font-size:13px; padding:0px; margin:10px;"> |
| 16 |
wpForo theme files contain the markup and template structure for frontend of your forum. |
| 17 |
Theme files can be found within the <span style="color:#43A6DF">/wpforo/wpf-themes/</span> directory, in current active theme folder, for example <span style="color:#43A6DF">/classic/</span>. |
| 18 |
You can edit these files in an upgrade-safe way using overrides. |
| 19 |
For example, copy the certain or all files of <span style="color:#43A6DF">/classic/</span> folder into a folder within your current active WordPress theme named <span style="color:#43A6DF">/wpforo/</span>, keeping the same file structure.<br> |
| 20 |
</p> |
| 21 |
<div style="background:#F5F5F5; border:#ddd 1px dotted; padding:10px 15px; margin:5px 0px; font-size:13px; line-height:18px;">Example: To override the "Topic List" template file of the Extended (#1) forum layout, copy according file: <span style="color:#43A6DF">plugins/wpforo/wpf-themes/classic/<span style="color:#C98B4C">layouts/1/topic.php</span></span> to <span style="color:#43A6DF">themes/yourtheme/wpforo/<span style="color:#C98B4C">layouts/1/topic.php</span></span></div> |
| 22 |
<p style="font-size:13px; padding:0px; margin:10px;"> |
| 23 |
The copied file will now automatically override the wpForo default theme file. All changes in this file will not be lost on forum update. |
| 24 |
<div style="background:#F6F7D8; border:#ddd 1px dotted; padding:10px 15px; margin:5px 0px; font-size:13px; line-height:18px;">Do not edit these files within the core plugin itself as they are overwritten during the upgrade process and any customizations will be lost.</div> |
| 25 |
</p> |
| 26 |
</div> |
| 27 |
|
| 28 |
<?php |
| 29 |
$themes = $wpforo->tpl->find_themes(); |
| 30 |
$theme_count = count($themes); |
| 31 |
$wpforo->theme; |
| 32 |
if(!empty($themes)): |
| 33 |
foreach( $themes as $main_file => $theme ): |
| 34 |
$theme_folder = trim(basename(dirname($main_file)), '/'); |
| 35 |
$theme_url = WPFORO_THEME_URL . '/' . $theme_folder; |
| 36 |
$layouts = $wpforo->tpl->find_themes('/'.$theme_folder.'/layouts', 'php', 'layout'); |
| 37 |
$styles = $wpforo->tpl->find_styles( $theme_folder ); |
| 38 |
$is_active = ( $wpforo->theme == $theme_folder ) ? true : false; |
| 39 |
$theme_archive = get_option( 'wpforo_theme_archive_' . $theme_folder ); |
| 40 |
$has_archive = (!empty($theme_archive)) ? true : false; |
| 41 |
?> |
| 42 |
<div class="wpf-div-table"> |
| 43 |
<div class="wpf-div-tr"> |
| 44 |
<div class="wpf-div-td" style="width:50%; border-bottom:1px dotted #ddd;"> |
| 45 |
<?php if( $is_active ): ?> |
| 46 |
<span style="color:#279800; font-weight:bold; text-transform:uppercase;"><?php _e('Current active theme', 'wpforo'); ?></span> |
| 47 |
<?php else: ?> |
| 48 |
<span style="color:#555555; font-weight:bold; text-transform:uppercase;"><?php _e('Inactive', 'wpforo'); ?></span> |
| 49 |
<?php endif; ?> |
| 50 |
</div> |
| 51 |
<div class="wpf-div-td" style="width:50%; border-bottom:1px dotted #ddd;"> |
| 52 |
<?php _e('LAYOUTS', 'wpforo'); ?> (<?php echo count($layouts) ?>) |
| 53 |
</div> |
| 54 |
</div> |
| 55 |
<div class="wpf-div-tr"> |
| 56 |
<div class="wpf-div-td" style="width:60%;"> |
| 57 |
<div class="wpf-theme-screenshot" style="background:url('<?php echo esc_url($theme_url) ?>/screenshot.png') 0 0 no-repeat;"></div> |
| 58 |
<div class="wpf-theme-info"> |
| 59 |
<h3 style="margin-top:5px; margin-bottom:10px;"><?php echo esc_html(wpforo_text( $theme['name']['value'], 30, false )) ?> | <?php echo ($theme['version']['value']) ? 'version ' . esc_html($theme['version']['value']) : ''; ?></h3> |
| 60 |
<p style="font-size:14px;" title="<?php echo esc_attr($theme['author']['value']) ?>"><?php echo ($theme['author']['value']) ? '<strong>Author:</strong> ' . esc_html(wpforo_text( $theme['author']['value'], 30, false )) : ''; ?></p> |
| 61 |
<p style="font-size:14px;" title="<?php echo esc_attr($theme['theme_url']['value']) ?>"><?php echo ($theme['theme_url']['value']) ? '<strong>URI:</strong> <a href="'.esc_url($theme['theme_url']['value']).'" target="_blank">' . esc_html(wpforo_text( $theme['theme_url']['value'], 30, false )) .'</a>' : ''; ?></p> |
| 62 |
<p style="margin-top:5px;"><?php echo ($theme['description']['value']) ? esc_html(wpforo_text($theme['description']['value'], 200, false)) : ''; ?></p> |
| 63 |
</div> |
| 64 |
<div class="wpf-theme-actions"> |
| 65 |
<?php if( $theme_count > 1 ): ?> |
| 66 |
<?php if( !$is_active ): ?> |
| 67 |
<?php if($has_archive): ?> |
| 68 |
<a href="<?php echo admin_url( 'admin.php?page=wpforo-themes&action=activate&theme=' . sanitize_text_field($theme_folder) ) ?>" class="wpf-action button"><?php _e('Activate', 'wpforo'); ?></a> |
| 69 |
<a href="<?php echo admin_url( 'admin.php?page=wpforo-themes&action=install&theme=' . sanitize_text_field($theme_folder) ) ?>" class="wpf-action button"><?php _e('Fresh Installation', 'wpforo'); ?></a> |
| 70 |
<?php else: ?> |
| 71 |
<a href="<?php echo admin_url( 'admin.php?page=wpforo-themes&action=install&theme=' . sanitize_text_field($theme_folder) ) ?>" class="wpf-action button"><?php _e('Install', 'wpforo'); ?></a> |
| 72 |
<?php endif; ?> |
| 73 |
<a href="<?php echo admin_url( 'admin.php?page=wpforo-themes&action=delete&theme=' . sanitize_text_field($theme_folder) ) ?>" class="wpf-delete button" onclick = "if (!confirm('<?php _e('Are you sure you want to delete this theme files?'); ?>')) { return false; }"><?php _e('Delete', 'wpforo'); ?></a> |
| 74 |
<?php else: ?> |
| 75 |
<?php if($has_archive): ?> |
| 76 |
<a href="<?php echo admin_url( 'admin.php?page=wpforo-themes&action=reset&theme=' . sanitize_text_field($theme_folder) ) ?>" class="wpf-action button" onclick = "if (!confirm('<?php _e('Are you sure you want to reset all settings and style colors to default?'); ?>')) { return false; }"><?php _e('Reset Settings', 'wpforo'); ?></a> |
| 77 |
<?php endif; ?> |
| 78 |
<?php endif; ?> |
| 79 |
<?php endif; ?> |
| 80 |
</div> |
| 81 |
</div> |
| 82 |
<div class="wpf-div-td" style="width:40%; border-left: 1px dotted #ddd;"> |
| 83 |
<?php |
| 84 |
if(!empty($layouts)){ |
| 85 |
foreach( $layouts as $layout ){ |
| 86 |
?> |
| 87 |
<div class="wpf-layout-info" style="display:block; border-bottom:1px dotted #ddd; padding:0px 0px 10px 0px; margin:0px 0px 10px 0px;"> |
| 88 |
<h4 style="margin:1px 0px;"><?php echo esc_html(wpforo_text( $layout['name']['value'], 30, false )) ?> <?php echo ($layout['version']['value']) ? '(' . esc_html($layout['version']['value']) .')' : ''; ?> | <?php echo ($layout['author']['value']) ? '<a href="'.esc_url($layout['layout_url']['value']).'" target="_blank">' .esc_html( wpforo_text( $layout['author']['value'], 25, false ) ) . '</a>' : ''; ?></h4> |
| 89 |
<p><?php echo ($layout['description']['value']) ? esc_html(wpforo_text($layout['description']['value'], 120, false)) : ''; ?></p> |
| 90 |
<!-- <p><a href="#" class="wpf-action">Deactivate</a> | <a href="#" class="wpf-delete">Delete</a></p> --> |
| 91 |
</div> |
| 92 |
<?php |
| 93 |
} |
| 94 |
} |
| 95 |
else{ |
| 96 |
?><div class="wpf-layout-info"><p style="text-align:center;"><? _e('No layout found', 'wpforo'); ?></p></div><?php |
| 97 |
} |
| 98 |
?> |
| 99 |
</div> |
| 100 |
</div> |
| 101 |
</div> |
| 102 |
<?php endforeach; ?> |
| 103 |
<?php else: ?> |
| 104 |
<div class="wpf-div-table"> |
| 105 |
<div class="wpf-div-tr"> |
| 106 |
<div class="wpf-div-td"> |
| 107 |
<p style="text-align:center;"><?php _e('No theme found', 'wpforo'); ?></p> |
| 108 |
</div> |
| 109 |
</div> |
| 110 |
</div> |
| 111 |
<?php endif; ?> |
| 112 |
|
| 113 |
</div> |