4ответ(ов) в теме
При обновлении wp-recall до крайней версии с v.13.8.0 фатал ерор происходит, логи:
PHP Fatal error: Call to undefined function add_tab_rcl() in /home/ocoznanie/web/ocoznanie.ru/public_html/wp-content/wp-recall/add-on/shortcode-tab/index.php on line 8
ссылаются на индекс файл дополнения к wp-recall сделанного на заказ, на строку:
add_tab_rcl('shortcode-edit','shortcode_edit_block','Шорткоды',array('public'=>0,'class'=>'fa-files-o','order'=>20));
Вот весь код того файла:
<?php
// Подключаем функции обработки шорткодов
include_once('shortcodes.php');
// Добавляем страницу настройки в меню
add_action('init','add_shortcode_editor');
function add_shortcode_editor(){
add_tab_rcl('shortcode-edit','shortcode_edit_block','Шорткоды',array('public'=>0,'class'=>'fa-files-o','order'=>20));
}
function add_tab_shortcodes_rcl($array_tabs){
$array_tabs['shortcode-edit']='shortcode_edit_block';
return $array_tabs;
}
add_filter('ajax_tabs_rcl','add_tab_shortcodes_rcl');
////////////////////////////////////////////////////////////////////////////
// Фронт
////////////////////////////////////////////////////////////////////////////
function shortcode_edit_block($user_lk){
global $user_LK;
$author = get_the_author_meta('display_name',$user_LK); // Получаем имя автора
$user_id = get_current_user_id(); // Получаем id автора
$query = new WP_Query( 'post_type=shortcodes&posts_per_page=1&author='.$user_id ); // Делаем выборку для следующей проверки
$user_shortcodes = $query->post_count; // Переменная где находится кол-во опубликованных страниц
$post_shortcodes = (array)$query->post->ID;
$post_id = $post_shortcodes[0]; // ID пстраницы автора с мета полями
// Проверяем пользователя на наличие созданных шорткодов. Если у пользователя нет созданных страниц, то создаем страницу с полями для шорткодов.
if ( $user_shortcodes == 0 ) {
$source = array(
'post_title' => 'Шорткоды ' . $author, // - заголовок.
'post_name' => 'shortcodes_'.$author, // - "слаг", синоним пути.
'post_excerpt' => '', // - цитата, анонс.
'post_content' => '', // - содержимое/контент.
'post_status' => 'publish', // - статус материала: опубликованный.
'post_author' => $user_id, // - автор материала.
'post_type' => 'shortcodes', // - тип контента.
'tags_input' => '', // - метки/теги.
'comment_status' => 'open' // - комментирование.
);
wp_insert_post($source);
}
// Если у пользователя есть страница, то обновляем данные страницы
else {
$source = array(
'ID' => $post_id, // - ID записи.
'post_title' => 'Шорткоды ' . $author, // - заголовок.
'post_name' => 'shortcodes_'.$author, // - "слаг", синоним пути.
'post_excerpt' => '', // - цитата, анонс.
'post_content' => '', // - содержимое/контент.
'post_status' => 'publish', // - статус материала: опубликованный.
'post_author' => $user_id, // - автор материала.
'post_type' => 'shortcodes', // - тип контента.
'tags_input' => '', // - метки/теги.
'comment_status' => 'open' // - комментирование.
);
wp_insert_post($source);
}
// Обработка данных формы
//define('WP_USE_THEMES', false);
//require( $_SERVER['DOCUMENT_ROOT'] .'/wp-blog-header.php');
if(isset($_POST['send_one']) == '1') {
$your_shortcode_one = $_POST['your_shortcode_one'];
$text_shortcode_one = $_POST['shortcode_one'];
$text_shortcode_two = $_POST['shortcode_two'];
$your_shortcode_two = $_POST['your_shortcode_two'];
$text_shortcode_three = $_POST['shortcode_three'];
$text_shortcode_four = $_POST['shortcode_four'];
$your_shortcode_three = $_POST['your_shortcode_three'];
$text_shortcode_five = $_POST['shortcode_five'];
$text_shortcode_six = $_POST['shortcode_six'];
update_post_meta($post_id, 'your_shortcode_one', $your_shortcode_one);
update_post_meta($post_id, 'shortcodes_fields_one', $text_shortcode_one);
update_post_meta($post_id, 'shortcodes_fields_two', $text_shortcode_two);
update_post_meta($post_id, 'your_shortcode_two', $your_shortcode_two);
update_post_meta($post_id, 'shortcodes_fields_three', $text_shortcode_three);
update_post_meta($post_id, 'shortcodes_fields_four', $text_shortcode_four);
update_post_meta($post_id, 'your_shortcode_three', $your_shortcode_three);
update_post_meta($post_id, 'shortcodes_fields_five', $text_shortcode_five);
update_post_meta($post_id, 'shortcodes_fields_six', $text_shortcode_six);
}
$your_shortcode_one = get_post_meta($post_id, 'your_shortcode_one', true);
$shortcodes_text_fields_one = get_post_meta($post_id, 'shortcodes_fields_one', true);
$shortcodes_text_fields_two = get_post_meta($post_id, 'shortcodes_fields_two', true);
$your_shortcode_two = get_post_meta($post_id, 'your_shortcode_two', true);
$shortcodes_text_fields_three = get_post_meta($post_id, 'shortcodes_fields_three', true);
$shortcodes_text_fields_four = get_post_meta($post_id, 'shortcodes_fields_four', true);
$your_shortcode_three = get_post_meta($post_id, 'your_shortcode_three', true);
$shortcodes_text_fields_five = get_post_meta($post_id, 'shortcodes_fields_five', true);
$shortcodes_text_fields_six = get_post_meta($post_id, 'shortcodes_fields_six', true);
if ( ( $shortcodes_text_fields_one =='' ) || ( $shortcodes_text_fields_one =='' ) || ( $shortcodes_text_fields_three =='' ) || ( $shortcodes_text_fields_four =='' ) || ( $shortcodes_text_fields_five =='' ) || ( $shortcodes_text_fields_six =='' ) ) {
$your_shortcode_one = 'default';
$your_shortcode_two = 'default';
$your_shortcode_three = 'default';
}
$form = '<div class="public_block">';
$form .= '<form method="POST" action="" class="">';
$form .= '
<table>
<tr>
<td>';
if ( $your_shortcode_one == "default" ) {
$form .= '
<input type="radio" name="your_shortcode_one" value="default" checked="checked" /> По умолчанию
<input type="radio" name="your_shortcode_one" value="authoredit" /> Шорткод автора';
} else {
$form .= '
<input type="radio" name="your_shortcode_one" value="default" /> По умолчанию
<input type="radio" name="your_shortcode_one" value="authoredit" checked="checked"/> Шорткод автора';
}
$form .= '
</td>
</tr>
<tr>
<td>';
ob_start();
wp_editor( $shortcodes_text_fields_one, 'wpeditorone', array('textarea_name' => 'shortcode_one','media_buttons' => false,'textarea_rows' => 8) );
$form .= ob_get_contents();
ob_end_clean();
$form .=
'</td>
</tr>
<tr>
<td>';
ob_start();
wp_editor( $shortcodes_text_fields_two, 'wpeditortwo', array('textarea_name' => 'shortcode_two','media_buttons' => false,'textarea_rows' => 8) );
$form .= ob_get_contents();
ob_end_clean();
$form .=
'</td>
</tr>
<tr>
<td colspan="2">
<button id="send_one" name="send_one" class="btn btn-primary">Сохранить</button>
</td>
</tr>
</table>
<hr>
<table>
<tr>
<td>';
if ( $your_shortcode_two == "default" ) {
$form .= '
<input type="radio" name="your_shortcode_two" value="default" checked="checked" /> По умолчанию
<input type="radio" name="your_shortcode_two" value="authoredit" /> Шорткод автора';
} else {
$form .= '
<input type="radio" name="your_shortcode_two" value="default" /> По умолчанию
<input type="radio" name="your_shortcode_two" value="authoredit" checked="checked"/> Шорткод автора';
}
$form .= '
</td>
</tr>
<tr>
<td>';
ob_start();
wp_editor( $shortcodes_text_fields_three, 'wpeditorthree', array('textarea_name' => 'shortcode_three','media_buttons' => false,'textarea_rows' => 8) );
$form .= ob_get_contents();
ob_end_clean();
$form .=
'</td>
</tr>
<tr>
<td>';
ob_start();
wp_editor( $shortcodes_text_fields_four, 'wpeditorfour', array('textarea_name' => 'shortcode_four','media_buttons' => false,'textarea_rows' => 8) );
$form .= ob_get_contents();
ob_end_clean();
$form .=
'</td>
</tr>
<tr>
<td colspan="2">
<button id="send_one" name="send_one" class="btn btn-primary">Сохранить</button>
</td>
</tr>
</table>
<hr>
<table>
<tr>
<td>';
if ( $your_shortcode_three == "default" ) {
$form .= '
<input type="radio" name="your_shortcode_three" value="default" checked="checked" /> По умолчанию
<input type="radio" name="your_shortcode_three" value="authoredit" /> Шорткод автора';
} else {
$form .= '
<input type="radio" name="your_shortcode_three" value="default" /> По умолчанию
<input type="radio" name="your_shortcode_three" value="authoredit" checked="checked"/> Шорткод автора';
}
$form .= '
</td>
</tr>
<tr>
<td>';
ob_start();
wp_editor( $shortcodes_text_fields_five, 'wpeditortfive', array('textarea_name' => 'shortcode_five','media_buttons' => false,'textarea_rows' => 8) );
$form .= ob_get_contents();
ob_end_clean();
$form .=
'</td>
</tr>
<tr>
<td>';
ob_start();
wp_editor( $shortcodes_text_fields_six, 'wpeditorsix', array('textarea_name' => 'shortcode_six','media_buttons' => false,'textarea_rows' => 8) );
$form .= ob_get_contents();
ob_end_clean();
$form .=
'</td>
</tr>
<tr>
<td colspan="2">
<button id="send_one" name="send_one" class="btn btn-primary">Сохранить</button>
</td>
</tr>
</table>
</form>';
$form .= '</div>';
return $form;
}
////////////////////////////////////////////////////////////////////////////
// Админка
////////////////////////////////////////////////////////////////////////////
// Добавляем настройки плагина в админку
add_action('admin_menu', 'public_editor_form_options_page_rcl',30);
function public_editor_form_options_page_rcl(){
add_submenu_page( 'manage-wprecall', 'Настройки шорткодов', 'Шорткоды', 'manage_options', 'shortcode-editors', 'recall_shortcod_setting');
}
// Функция вывода настроек в админке
function recall_shortcod_setting() {
?>
<div class="wrap">
<h2>Настройки дополнения Shortcode Tabb Wp-Recall</h2>
<hr>
<?php
include_once 'admin-shortcodes.php';
return shortcodes_setting();
?>
</div>
<?php
}
?>
Автор дополнения сейчас не доступен, у них там мобилизация и т.д., так что он помочь не может(
Тема закрыта. Публикация новых сообщений запрещена.