Forum Replies Created

Viewing 15 replies - 16 through 30 (of 181 total)
  • Thread Starter Andry

    (@blackstar1991)

    Thanks

    Thread Starter Andry

    (@blackstar1991)

    
    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

    • This reply was modified 5 months, 3 weeks ago by Andry.
    • This reply was modified 5 months, 3 weeks ago by Andry.
    Thread Starter Andry

    (@blackstar1991)

    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.
    Thread Starter Andry

    (@blackstar1991)

    Thanks, that helped with the JS. My html validator sees an issue with elements… but it’s not a big deal.

    Thread Starter Andry

    (@blackstar1991)

    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;
    Thread Starter Andry

    (@blackstar1991)

    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
    Thread Starter Andry

    (@blackstar1991)

    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.
    Thread Starter Andry

    (@blackstar1991)

    Thanks. Is it possible to make for some form available share buttons and for other disabled ?

    Thread Starter Andry

    (@blackstar1991)

    Thanks, Unfortunately, this did not completely solve the full problem. The icons are still not centered. Can this be fixed at the plugin level?

    Andry

    (@blackstar1991)

    Did you correct setup ?UM Register, ?UM Login , ?UK Account pages and other pages into plugin ? Show the screenshot of your settings

    Thread Starter Andry

    (@blackstar1991)

    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');
    }
    ?>
    
    Thread Starter Andry

    (@blackstar1991)

    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,
                ));
    Thread Starter Andry

    (@blackstar1991)

    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.

    Thread Starter Andry

    (@blackstar1991)

    No it dosen’t . I turn off all plugins set default template Twenty Twenty and my user with role Contributor stell can see Tab Tools.

    Thread Starter Andry

    (@blackstar1991)

    OK. 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.

Viewing 15 replies - 16 through 30 (of 181 total)