PluginProbe
wpForo Forum / 3.0.9
wpForo Forum v3.0.9
3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 All 137 releases
wpforo / admin / pages / themes.php

themes.php in wpForo Forum 3.0.9, at admin/pages/themes.php

102 lines 7.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if( ! defined( 'ABSPATH' ) ) exit;
4 if( ! WPF()->usergroup->can( 'mth' ) ) exit;
5 ?>
6
7 <div id="wpf-admin-wrap" class="wrap wpforo-themes">
8 <h2 style="padding:20px 0 0; line-height: 20px; margin-bottom:15px;">
9 <?php _e( 'Forum Themes', 'wpforo' ); ?>
10 </h2>
11 <?php WPF()->notice->show() ?>
12
13 <div style="box-shadow:none; margin:25px 0 20px;" class="wpf-info-bar">
14 <p style="font-size:13px; padding:0; margin:10px;">
15 wpForo theme files contain the markup and template structure for frontend of your forum.
16 Theme files can be found within the <span style="color:#43A6DF">/wpforo/themes/</span> directory, in current active theme folder, for example <span style="color:#43A6DF">/2026/</span>.
17 You can edit these files in an upgrade-safe way using overrides.
18 For example, copy the certain or all files of <span style="color:#43A6DF">/2026/</span> folder into a folder within your current active WordPress theme named <span style="color:#43A6DF">/wpforo/</span>, keeping the same file structure.<br>
19 </p>
20 <div style="background:#F5F5F5; border:#ddd 1px dotted; padding:10px 15px; margin:5px 0; 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/themes/2026/<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>
21 <p style="font-size:13px; padding:0; margin:10px;">
22 The copied file will now automatically override the wpForo default theme file. All changes in this file will not be lost on forum update.
23 </p>
24 <div style="background:#F6F7D8; border:#ddd 1px dotted; padding:10px 15px; margin:5px 0; 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 </div>
26
27 <?php
28 $themes = WPF()->tpl->find_themes();
29 if( ! empty( $themes ) ) :
30 $_tk = WPF()->tpl->theme . '/style.css';
31 $_t = $themes[$_tk];
32 unset( $themes[$_tk] );
33 $themes = array_merge( [ $_tk => $_t], $themes );
34 foreach( $themes as $main_file => $theme ):
35 $theme_folder = trim( basename( dirname( (string) $main_file ) ), '/' );
36 $theme_url = WPFORO_THEME_URL . '/' . $theme_folder;
37 $layouts = WPF()->tpl->find_themes( '/' . $theme_folder . '/layouts', 'php', 'layout' );
38 $styles = WPF()->tpl->find_styles( $theme_folder );
39 $is_active = WPF()->tpl->theme === $theme_folder;
40 $theme_archive = wpforo_get_option( 'theme_archive_' . $theme_folder, [], false );
41 $has_archive = ! empty( $theme_archive );
42 ?>
43 <div class="wpf-div-table">
44 <div class="wpf-div-tr">
45 <div class="wpf-div-td" style="width:50%; border-bottom:1px dotted #ddd;">
46 <?php if( $is_active ): ?>
47 <span style="color:#279800; font-weight:bold; text-transform:uppercase;"><?php _e( 'Current active theme', 'wpforo' ); ?></span>
48 <?php else: ?>
49 <span style="color:#555555; font-weight:bold; text-transform:uppercase;"><?php _e( 'Inactive', 'wpforo' ); ?></span>
50 <?php endif; ?>
51 </div>
52 <div class="wpf-div-td" style="width:50%; border-bottom:1px dotted #ddd;">
53 <?php _e( 'LAYOUTS', 'wpforo' ); ?> (<?php echo count( $layouts ) ?>)
54 </div>
55 </div>
56 <div class="wpf-div-tr">
57 <div class="wpf-div-td" style="width:60%;">
58 <div class="wpf-theme-screenshot" style="background:url('<?php echo esc_url( (string) $theme_url ) ?>/screenshot.png') 0 0 no-repeat;background-size: cover;"></div>
59 <div class="wpf-theme-info">
60 <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>
61 <p style="font-size:14px;" title="<?php echo esc_attr( $theme['author']['value'] ) ?>"><?php echo ( $theme['author']['value'] ) ? '<strong>Author:</strong>&nbsp; ' . esc_html( wpforo_text( $theme['author']['value'], 30, false ) ) : ''; ?></p>
62 <p style="font-size:14px;" title="<?php echo esc_attr( $theme['theme_url']['value'] ) ?>"><?php echo ( $theme['theme_url']['value'] ) ? '<strong>URI:</strong>&nbsp; <a href="' . esc_url( (string) $theme['theme_url']['value'] ) . '" target="_blank">' . mb_substr( (string) $theme['theme_url']['value'], 0, 30 ) . '</a>' : ''; ?></p>
63 <p style="margin-top:5px;"><?php echo ( $theme['description']['value'] ) ? esc_html( wpforo_text( $theme['description']['value'], 200, false ) ) : ''; ?></p>
64 </div>
65 <div class="wpf-theme-actions">
66 <?php if( count( $themes ) > 1 && ! $is_active ): ?>
67 <a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=wpforo-themes&wpfaction=theme_activate&theme=' . sanitize_text_field( $theme_folder ) ), 'wpforo-theme-activate' ) ?>" class="wpf-action button"><?php _e( 'Activate', 'wpforo' ); ?></a>
68 <a href="<?php echo wp_nonce_url( admin_url( 'admin.php?page=wpforo-themes&wpfaction=theme_delete&theme=' . sanitize_text_field( $theme_folder ) ), 'wpforo-theme-delete' ) ?>" class="wpf-delete button" onclick="return confirm('<?php _e( 'Are you sure you want to delete this theme files?' ) ?>')"><?php _e( 'Delete', 'wpforo' ); ?></a>
69 <?php endif; ?>
70 </div>
71 </div>
72 <div class="wpf-div-td" style="width:40%; border-left: 1px dotted #ddd;">
73 <?php
74 if( ! empty( $layouts ) ) {
75 foreach( $layouts as $layout ) {
76 ?>
77 <div class="wpf-layout-info" style="display:block; border-bottom:1px dotted #ddd; padding:0 0 10px; margin:0 0 10px;">
78 <h4 style="margin:1px 0;"><?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( (string) $layout['layout_url']['value'] ) . '" target="_blank">' . esc_html( wpforo_text( $layout['author']['value'], 25, false ) ) . '</a>' : '' ?></h4>
79 <p><?php echo ( $layout['description']['value'] ) ? esc_html( wpforo_text( $layout['description']['value'], 120, false ) ) : ''; ?></p>
80 </div>
81 <?php
82 }
83 } else {
84 ?>
85 <div class="wpf-layout-info"><p style="text-align:center;"><? _e( 'No layout found', 'wpforo' ); ?></p></div><?php
86 }
87 ?>
88 </div>
89 </div>
90 </div>
91 <?php endforeach; ?>
92 <?php else: ?>
93 <div class="wpf-div-table">
94 <div class="wpf-div-tr">
95 <div class="wpf-div-td">
96 <p style="text-align:center;"><?php _e( 'No theme found', 'wpforo' ); ?></p>
97 </div>
98 </div>
99 </div>
100 <?php endif; ?>
101 </div>
102