Andry
Forum Replies Created
-
Forum: Plugins
In reply to: [WordPress Hide Posts] How hide posts en masse ?Thanks
Forum: Plugins
In reply to: [Yoast SEO] How remove categories and tags from sitemap.xml?function sitemap_exclude_taxonomy( $excluded, $taxonomy ) { return $taxonomy === 'e-books-category'; } add_filter( 'wpseo_sitemap_exclude_taxonomy', 'sitemap_exclude_taxonomy', 10, 2 );
Thanks. it helped
Forum: Plugins
In reply to: [Yoast SEO] How remove categories and tags from sitemap.xml?But I don’t see custom post types in this section. In my casy I have
post_type="e-books"
But I don’t see it.register_post_type('e-books', array( 'description' => __('E-books & Whitepapers description', 'test'), 'public' => true, 'publicly_queryable' => true, 'show_in_menu' => true, 'has_archive' => true, 'supports' => array('title', 'editor', 'thumbnail', 'excerpt'), 'sticky' => true, 'labels' => array( 'name' => __('E-books & Whitepapers'), 'singular_name' => __('E-books & Whitepapers'), ), 'rewrite' => array('slug' => 'e-books', 'with_front' => false), 'taxonomies' => array(''), 'show_ui' => true, 'capability_type' => 'post', 'show_in_rest' => false, ) );
- This reply was modified 5 months, 3 weeks ago by Andry.
Forum: Plugins
In reply to: [Comments - wpDiscuz] Incorrect repeated code in pluginThanks, that helped with the JS. My html validator sees an issue with elements… but it’s not a big deal.
Forum: Developing with WordPress
In reply to: Guttenberg block that add class for selected element.I find the problem in bad instaletion of component.
const { __ } = wp.i18n; const { registerFormatType, toggleFormat, applyFormat } = wp.richText; const { ToolbarGroup, ToolbarButton } = wp.components; import { BlockControls } from '@wordpress/block-editor'; import { registerShortcut } from '@wordpress/keycodes'; const name = 'block-fields/add-class'; const className = 'wp-block-custom-red'; const add_class = { name, title: __('Add Class'), tagName: 'span', className, edit({ isActive, value, onChange }) { const onToggle = () => { onChange( toggleFormat(value, { type: name }), applyFormat(value, { type: name, attributes: { tagName: 'span', className: isActive ? className : null } }) ); }; return ( <BlockControls> <ToolbarGroup> <ToolbarButton icon="editor-paste-word" title={__('Add Class')} onClick={onToggle} isActive={isActive} /> </ToolbarGroup> </BlockControls> ); }, }; function registerFormats() { registerFormatType(name, add_class); } registerFormats(); export default add_class;
Forum: Developing with WordPress
In reply to: Guttenberg block that add class for selected element.Hmmm, I rewrote it as in the example, but now it doesn’t work.
const { __ } = wp.i18n; const { registerFormatType, toggleFormat } = wp.richText; //const { RichTextToolbarButton, RichTextShortcut } = wp.editor; const { ToolbarGroup, ToolbarButton } = wp.components; const { BlockControls } = wp.block-editor; const name = 'block-fields/add-class'; const add_class = { name, title: __('Add Class'), tagName: 'span', className: null, edit({ isActive, value, onChange }) { const onToggle = () => { onChange( toggleFormat(value, { type: name }), applyFormat(value, { type: name, attributes: { tagName: 'span', className: isActive ? 'wp-block-custom-red' : null } }) ); }; return ( <BlockControls> <ToolbarGroup> <ToolbarButton icon="editor-paste-word" title={__('Add Class')} onClick={onToggle} isActive={ isActive } /> </ToolbarGroup> </BlockControls> ); }, }; function registerFormats() { registerFormatType(name, add_class); } registerFormats(); export default add_class;
I got a problem – “Uncaught ReferenceError: editor is not defined”
Can you give any other tips ? *I instaled
npm install @wordpress/editor --save
Forum: Developing with WordPress
In reply to: Guttenberg block that add class for selected element.Unfortunately I don’t understand how to solve this.
blocks.min.js:19 The "edit" property must be a valid component. VM3190:3 Symbol.observable as defined by Redux and Redux DevTools do not match. This could cause your app to behave differently if the DevTools are not loaded. Consider polyfilling Symbol.observable before Redux is imported or avoid polyfilling Symbol.observable altogether. blocks.min.js:19 The "edit" property must be a valid component. VM3190:3 Symbol.observable as defined by Redux and Redux DevTools do not match. This could cause your app to behave differently if the DevTools are not loaded. Consider polyfilling Symbol.observable before Redux is imported or avoid polyfilling Symbol.observable altogether.
Forum: Plugins
In reply to: [Comments - wpDiscuz] Is it possible to disable the Share buttons?Thanks. Is it possible to make for some form available share buttons and for other disabled ?
Thanks, Unfortunately, this did not completely solve the full problem. The icons are still not centered. Can this be fixed at the plugin level?
Did you correct setup ?UM Register, ?UM Login , ?UK Account pages and other pages into plugin ? Show the screenshot of your settings
Forum: Developing with WordPress
In reply to: How to display comments in reverse order with pagination?Unfortunately it doesn’t work.
custom-comments-pagination.php
<?php $args = array( 'post_id' => get_the_ID(), 'parent' => 0, 'count' => true, ); $top_level_comments_count = get_comments($args); $max_pages = ceil($top_level_comments_count / $per_page); $args = array( 'screen_reader_text' => __('Comments navigation'), 'aria_label' => __('Comments'), 'class' => 'comments-pagination', 'format' => '', 'total' => $max_pages, 'current' => $page, 'prev_text' => '?', 'next_text' => '?', 'type' => 'plain', 'echo' => false, 'toggle_state'=>isset($_GET['toggle_state']) ? $_GET['toggle_state'] : false, ); $pagination = get_the_comments_pagination($args); $pagination = str_replace('#comments', '', $pagination); ?> <div class="company-rewiew-pagination"> <?php echo $pagination; ?> </div>
custom-comments-template.php
<?php if (post_password_required()) { return; } $post_id = get_the_ID(); $per_page = 4; $comments_count = get_comments_number($post_id); if (isset($_GET['cpage']) && is_numeric($_GET['cpage'])) { $page = (int)$_GET['cpage']; } $page = get_query_var('cpage'); $page = is_numeric($page) ? (int)$page : 1; $GET_value_filter = filter_input(INPUT_GET, 'filter', FILTER_SANITIZE_ENCODED); ?> <style> #comments{ max-width: 600px; margin: 10px auto; } .rewiew-card{ padding: 10px; border: 1px solid #000; } .comments-pagination .page-numbers{ display: inline-block!important; } .comments-pagination{ justify-content: center; margin: 30px auto; } </style> <a href="/test/?filter=newest">NEWS COMMENTS</a> <div id="comments" class="company-rewiew-list"> <?php var_dump($page); if (empty($GET_value_filter)) { function custom_default_comments_page1($value) { return 'oldest'; } add_filter('pre_option_default_comments_page', 'custom_default_comments_page1'); wp_list_comments(array( 'type' => 'comment', 'reverse_top_level' => false, 'reverse_children' => false, 'callback' => 'reviews_theme_comment', 'per_page' => $per_page, 'number' => $per_page, 'cpage' => $page, )); } elseif ($GET_value_filter == 'newest') { echo '<h1>We need to show newest order comments</h1>'; $comment_count = wp_count_comments($post_id); $comments_count = $comment_count->approved; $args = array( 'type' => 'comment', 'status' => 'approve', 'post_id' => $post_id, 'order' => 'DESC', 'offset' => ($page - 1) * $per_page, 'number' => $per_page, ); $comments = get_comments($args); wp_list_comments(array( 'type' => 'comment', 'callback' => 'reviews_theme_comment', 'comments' => $comments, 'total' => $comments_count, 'per_page' => $per_page, 'reverse_top_level' => isset($_GET['toggle_state']) ? $_GET['toggle_state'] : false, 'reverse_children' => isset($_GET['toggle_state']) ? $_GET['toggle_state'] : false, )); } ?> </div> <?php function reviews_theme_comment($comment, $args, $depth) { $comment_ID = intval($comment->comment_ID); if (!$comment->comment_parent) { echo '<div class="rewiew-card">'; ?> <div id="comment-<?php comment_ID() ?>" itemprop="review" itemscope itemtype="https://schema.org/Review"> <div class="review_content__text"><?php comment_text(); ?></div> </div> <?php } else { ?> <li id="comment-<?php comment_ID() ?>" class="rewiew-card-item _reply"> <div class="review_content__text"><?php comment_text(); ?></div> </div> </li> <?php } if (($depth == 1)) { echo '</div>'; } ?> <?php } ?> <?php if (($per_page > 1) && ($comments_count > $per_page)) { include locate_template('template-parts/custom-comments-pagination.php'); } ?>
Forum: Developing with WordPress
In reply to: How to display comments in reverse order with pagination?Can you explain more please?
$comment_count = wp_count_comments($post_id); $comments_count = $comment_count->approved; $offset = ($page - 1) * $per_page; $args = array( 'type' => 'comment', 'status' => 'approve', 'post_id' => $post_id, 'order' => 'DESC', 'offset' => $offset, 'number' => $per_page, ); $comments = get_comments($args); wp_list_comments(array( 'type' => 'comment', 'callback' => 'reviews_theme_comment', 'comments' => $comments, 'total' => $comments_count, 'per_page' => 4, ));
Thanks, I see this problem in all templates. I showed this on Twenty Twenty because it’s a simple template to display by default. I think that it can be WP core problem…
I’ll try to ask on this forum thread, thanks.
Forum: Fixing WordPress
In reply to: Bug Tools menu for Contributor rolesNo it dosen’t . I turn off all plugins set default template Twenty Twenty and my user with role Contributor stell can see Tab Tools.
Forum: Fixing WordPress
In reply to: Bug Tools menu for Contributor rolesOK. What roles other than Administrator and Site Moderator can visit the administration panel? (wp_admin)
I write this on empty test WP site. I has only one plugin – Ultimate Member
I see this problem in any default template.