Forum Replies Created

Viewing 15 replies - 31 through 45 (of 72 total)
  • Thread Starter bearshang

    (@bearshang)

    @pingram3541
    I’m sorry, But I still have not solved this problem.

    When I edit the component,E.g Title,Custom js code will not be automatically loaded.

    Thread Starter bearshang

    (@bearshang)

    https://ojnt2lb2b.bkt.clouddn.com/20171108151615.png

    OK, this is the interface I opened Elementor,
    The content of the Tabs is controlled by js, js code is written in frontend-elementor.js, the default Tabs content is hidden, that is, display: none;
    I control the display of Tabs content through js, but obviously now he does not work.

    This js is:

    
    /**
     * Elementor for tn-custom-tabs
     */
    ;( function ($) {
        $(function () {
            $tabs_scope = $( '.tn-custom-tabs-container' );
            var defaultActiveTab = $tabs_scope.find( '.tn-custom-tabs' ).data( 'active-tab' ),
                $tabsTitles = $tabs_scope.find( '.tn-tabs-title' ),
                $tabs = $tabs_scope.find( '.tn-tabs-content' ),
                $active,
                $content;
    
            if ( ! defaultActiveTab ) {
                defaultActiveTab = 1;
            }
    
            var activateTab = function( tabIndex ) {
                if ( $active ) {
                    $active.removeClass( 'active' );
    
                    $content.hide();
                }
    
                $active = $tabsTitles.filter( '[data-tab="' + tabIndex + '"]' );
    
                $active.addClass( 'active' );
    
                $content = $tabs.filter( '[data-tab="' + tabIndex + '"]' );
    
                $content.show();
            };
    
            activateTab( defaultActiveTab );
    
            $tabsTitles.on( 'click', function() {
                activateTab( this.dataset.tab );
            } );
        })
    } )( jQuery )
    

    This html is:

    
    <div class="tn-custom-tabs-container" role="tablist">
                <div class="tn-tabs-wrapper" role="tab">
    
                    
                        <div class="tn-tabs-title" data-tab="1">New products</div>
    
                        
                        <div class="tn-tabs-title" data-tab="2">Featured Products</div>
    
                        
                </div>
    
                <div class="tn-tabs-content-wrapper" role="tabpanel">
    
                    
                        <div class="tn-tabs-content" data-tab="1">
    
                            <div class="tn-custom-tabs-items">
    
                                
                                <div class="tab-items clearfix">
    
                                    
                                            <div class="tab-item">
                                                <a href="https://dev.planting.com/product/going-through/" target="_blank">
    
                                                                                                    <div class="image">
    
                                                        <img width="245" height="300" src="https://dev.planting.com/wp-content/uploads/sites/15/2017/10/printed-summer-dress-245x300.jpg" class="attachment-medium size-medium wp-post-image" alt="" dh="150px" srcset="https://dev.planting.com/wp-content/uploads/sites/15/2017/10/printed-summer-dress-245x300.jpg 245w, https://dev.planting.com/wp-content/uploads/sites/15/2017/10/printed-summer-dress-147x180.jpg 147w, https://dev.planting.com/wp-content/uploads/sites/15/2017/10/printed-summer-dress.jpg 400w" sizes="(max-width: 245px) 100vw, 245px">
                                                    </div>
                                                    
                                                    <div class="info">
                                                        <h4 class="title">Going Through</h4>
                                                        <p class="excerpt">Long printed dress with thin adjustable straps. V-neckline and wiri...</p>                                                </div>
    
                                                </a>
                                            </div>
    
                                            
                                </div>
    
                                    <div class="tn-custom-tabs-more"><a href="" target="_blank">See More</a></div>
                            </div>
    
                        </div>
    
                        
                        <div class="tn-tabs-content" data-tab="2">
    
                            <div class="tn-custom-tabs-items">
    
                                
                                <div class="tab-items clearfix">
    
                                    
                                            <div class="tab-item">
                                                <a href="https://dev.planting.com/product/going-through/" target="_blank">
    
                                                                                                    <div class="image">
    
                                                        <img width="245" height="300" src="https://dev.planting.com/wp-content/uploads/sites/15/2017/10/printed-summer-dress-245x300.jpg" class="attachment-medium size-medium wp-post-image" alt="" dh="150px" srcset="https://dev.planting.com/wp-content/uploads/sites/15/2017/10/printed-summer-dress-245x300.jpg 245w, https://dev.planting.com/wp-content/uploads/sites/15/2017/10/printed-summer-dress-147x180.jpg 147w, https://dev.planting.com/wp-content/uploads/sites/15/2017/10/printed-summer-dress.jpg 400w" sizes="(max-width: 245px) 100vw, 245px">
                                                    </div>
                                                    
                                                    <div class="info">
                                                        <h4 class="title">Going Through</h4>
                                                        <p class="excerpt">Long printed dress with thin adjustable straps. V-neckline and wiri...</p>                                                </div>
    
                                                </a>
                                            </div>
    
                                            
                                </div>
    
                                    <div class="tn-custom-tabs-more"><a href="" target="_blank">See More</a></div>
                            </div>
    
                        </div>
    
                        
                </div>
            </div>
    

    Do not know if I understand this way?

    Thread Starter bearshang

    (@bearshang)

    Instead of replacing, I added a new piece of JS code that I introduced via wp_enqueue_script, but now he does not work

    Thread Starter bearshang

    (@bearshang)

    I’m sorry, wp_mail is Available.

    Thread Starter bearshang

    (@bearshang)

    @jdembowski
    Ok,
    I just want to replace the page’s default url domain name, in order to achieve the purpose of reverse proxy, for /wp-admin/admin-ajax.php this request, because he is POST type, it can not make sub_filter effective…

    Thread Starter bearshang

    (@bearshang)

    @tm3909
    @pothi

    I found a solution to the problem:

    
    add_action( 'init', 'flush_rewrite', 99 );
    function flush_rewrite()
    {
        flush_rewrite_rules();
    }
    
    Thread Starter bearshang

    (@bearshang)

    @tm3909
    @pothi

    Lucky, I found the reason, not the result of nginx configuration, but a multi-language plug-in cause, The plugin name is ‘Polylang’…

    I use this plugin and add a language at the same time that could destroy the permalink structure, causing permalink to fail…

    Thank you very much for your reply!

    Thread Starter bearshang

    (@bearshang)

    @tm3909
    How to say it…

    I follow the methods in the data are tested, the problem still exists…

    This is my nginx configure:

    
    server
        {
            listen 80;
            server_name dev.trueniu.com *.dev.trueniu.com;
            index  index.php index.html index.htm;
            root  /home/wwwroot/trueniu-php/trueniu;
    
            include enable-php.conf;
            include wordpress.conf;
        }
    

    wordpress.conf:

    
    access_log /home/wwwlogs/nginx_access.log;
    
    location / {
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$args;
    }
    

    And I tried your method @pothi ,Unfortunately,he does not seem to have any effect;

    So I boldly guess the problem should not be on the nginx configuration,
    Because I use the multi-site subdomain mode, in the same wordpress program under the other sub-domain site performance is good, and did not appear this problem.

    There must be something else that causes this problem to happen.-_-

    Thread Starter bearshang

    (@bearshang)

    And i should have found the reason, but it is so not confident…”_”

    When setting the page-attributes in the parameters of the custom post type supports,There will be such a situation.

    Thread Starter bearshang

    (@bearshang)

    @bcworkz
    Thank you very much.

    And there is a doubt:

    
    register_rest_field( 'post', 'menu_order', [
        'get_callback'    => function( $arr ) {
            $post_obj = get_post( $arr['id'] );
    
            return (int)$post_obj->menu_order;
        },
        'update_callback' => function( $menu_order, $obj ) {
            $ret = wp_update_post( array(
                'ID'         => $obj->id,
                'menu_order' => $menu_order,
            ) );
            if ( is_wp_error( $ret ) ) {
                return new WP_Error(
                    'rest_menu_order_failed',
                    __( 'Failed to update menu_order field.' ),
                    array( 'status' => 500 )
                );
            }
    
            return true;
        },
        'schema'          => array(
            'description' => __( 'Posts menu_order.', 'trueniu-init' ),
            'type'        => 'integer',
        ),
    ] );
    

    As you can see, I just registered the post type menu_order field.
    At the same time, I have other custom post type: service;
    But,when i access xx.com/wp-json/wp/v2/service/144,The surprising thing happened;
    The register rest filed menu_order have update for service.

    Normally, register_rest_field just registers the menu_order field of for post, but I do not understand why the type of article for the type of service will also work…

    Thread Starter bearshang

    (@bearshang)

    Thread Starter bearshang

    (@bearshang)

    I found the reason that was caused by my negligence..

    Did you see the <? Php get_sidebar ();?> In single.php?

    Here, I developed a widget for getting custom post type.

    But at the end of the widgets code I did not use wp_reset_postdata ().

    Because of this, he always shows the first article, thank you very much for your reply

    happy code for everyday.

    Thread Starter bearshang

    (@bearshang)

    No,No,No

    I think I may not have to understand.

    i use 'post_type' => $post->post_name is corrects

    Because work in the page.php everything is normal, through WP_Query get to the corresponding article items.

    The only thing that is not normal is single.php, when I click on permalink in page.php, he shows the article on single.php is always the first one, it is strange

    Thread Starter bearshang

    (@bearshang)

    As you can see.
    https://csninsp.trueniu.com/service/
    https://csninsp.trueniu.com/training/
    https://csninsp.trueniu.com/video/
    https://csninsp.trueniu.com/industry/

    They are all page,in page.php, i use cuscom post type name as a query condition:

    
    <div id="main" role="main" class="wpv-main layout-full boxed-layout">
            <div class="row page-wrapper">
    
                <?php
                /**
                 * Loop the content
                 */
                while ( have_posts() ) : the_post(); ?>
    
                    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
                        <div class="post-content">
    
                            <?php the_content(); ?>
    
                
                            <?php
                            /**
                             * Is front page for static page
                             */
                            global $post;
    
                            if ( is_page( 'industry' ) ) :
                                $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                                $industrys = new WP_Query( array(
                                    'post_type' => $post->post_name,
                                    'posts_per_page' => 16,
                                    'post_status' => 'publish',
                                    'paged' => $paged
                                ) ); ?>
                                <section class="portfolios normal industry-items">
                                    <ul class="clearfix fit-rows portfolio-items">
                                        <?php while ( $industrys->have_posts() ) : $industrys -> the_post();?>
                                            <li class="grid-1-4">
                                                <div class="portfolio-item-wrapper">
                                                    <div class="portfolio-image">
                                                        <div class="thumbnail">
                                                            <?php the_post_thumbnail( 'custom-size-industry', array( 'dh' => '303px' ) ); ?>
                                                        </div>
                                                    </div>
                                                    <div class="portfolio_details">
                                                        <a href="<?php the_permalink(); ?>" target="_blank">
                                                            <h3 class="title"><?php the_title(); ?></h3>
                                                            <div class="excerpt"><p>Learn More</p></div>
                                                        </a>
                                                    </div>
                                                </div>
                                            </li>
                                        <?php endwhile; wp_reset_postdata(); ?>
                                    </ul>
    
                                    <?php
                                    /**
                                     * The pagenation
                                     */
                                    $links = paginate_links( array(
                                        'current'            => max( 1, $paged ),
                                        'prev_text'          => __('?'),
                                        'next_text'          => __('?'),
                                        'total'              => $industrys->max_num_pages,   //WP_Query结果集中可以显示的最大页数
                                    ) );
                                    echo _navigation_markup( $links, 'pagination', 'screen_reader_text' ); ?>
    
                                </section>
                            <?php elseif ( is_page( 'video' ) ) :
                                $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                                $video_posts = new WP_Query( array(
                                    'post_type' => $post->post_name,
                                    'posts_per_page' => 16,
                                    'post_status' => 'publish',
                                    'paged' => $paged
                                ) );
                            ?>
                                <div class="limit-wrapper clearfix">
                                    <?php while ( $video_posts->have_posts() ) : $video_posts -> the_post(); ?>
                                    <div class="wpv-grid grid-1-3">
                                        <a href="<?php the_permalink(); ?>" target="_blank">
                                            <div class="linkarea">
                                                <div class="first">
                                                    <?php the_post_thumbnail( 'medium', array( 'dh' => '150px' ) ); ?>
                                                </div>
                                                <div class="last"><h3><?php the_title(); ?></h3>
                                                    <p><?php echo mb_strimwidth( strip_tags( get_the_excerpt() ), '0', '60', '...' ); ?></p>
                                                    <p>
                                                        <span class="fl"><i class="videos-icon-clock"></i> <?php echo get_the_date( 'Y-m-d' ); ?></span>
                                                        <span class="fr"><i class="videos-icon-eye"></i> <?php echo tn_get_record_visitors_num( '', '' ); ?></span>
                                                    </p>
                                                </div>
                                            </div>
                                        </a>
                                    </div>
                                    <?php
                                    endwhile;
                                    wp_reset_postdata();
                                    ?>
                                </div>
                                <?php
                                /**
                                 * The pagenation
                                 */
                                $links = paginate_links( array(
                                    'current'            => max( 1, $paged ),
                                    'prev_text'          => __('?'),
                                    'next_text'          => __('?'),
                                    'total'              => $video_posts->max_num_pages,   //WP_Query结果集中可以显示的最大页数
                                ) );
                                echo _navigation_markup( $links, 'pagination', 'screen_reader_text' );
    
                            else :
                                $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                                $custom_posts= new WP_Query( array(
                                'post_type' => $post->post_name,
                                'posts_per_page' => 16,
                                'post_status' => 'publish',
                                'paged' => $paged
                                ) );
                            ?>
                            <div class="limit-wrapper">
                            <?php while ( $custom_posts->have_posts() ) : $custom_posts-> the_post(); ?>
                                <div class="page-content">
                                    <div class="loop-wrapper regular">
                                        <div class="list-item">
                                            <div class="post-article">
                                                <div class="video-post-format">
                                                    <div class="post-row">
                                                        <div class="post-row-left">
                                                            <div class="post-date">
                                                                <span class="top-part"><?php echo get_the_date('d'); ?></span>
                                                                <span class="bottom-part"><?php echo get_the_date('m y'); ?></span>
                                                            </div>
                                                        </div>
                                                        <div class="post-row-center">
                                                            <?php
                                                            if ( has_post_thumbnail() ) :?>
                                                                <div class="post-media">
                                                                    <div class="media-inner">
                                                                        <?php the_post_thumbnail('custom-size-news', array('dh' => '160px')); ?>
                                                                    </div>
                                                                </div>
                                                            <?php endif; ?>
                                                            <div class="post-content-outer">
                                                                <header class="single">
                                                                    <div class="content">
                                                                        <h3>
                                                                            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                                                                        </h3>
                                                                    </div>
                                                                </header>
                                                                <div class="post-content the-content">
                                                                    <p><?php the_excerpt(); ?></p>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <?php
                                endwhile;
                                wp_reset_postdata();
    
                                /**
                                 * The pagenation
                                 */
                                $links = paginate_links( array(
                                    'current'            => max( 1, $paged ),
                                    'prev_text'          => __('?'),
                                    'next_text'          => __('?'),
                                    'total'              => $custom_posts->max_num_pages,   //WP_Query结果集中可以显示的最大页数
                                ) );
                                echo _navigation_markup( $links, 'pagination', 'screen_reader_text' );
    
                            endif;
                            ?>
                            </div>
                        </div><!-- .entry-content -->
    
                    </article><!-- #post-<?php the_ID(); ?> -->
    
                <?php endwhile; // End of the loop. ?>
    
            </div><!-- #main -->
        </div><!-- #primary -->
    

    But when I click on these custom Post type links to the detail page, he always shows me the same content in the development environment, and the problem is not happening.

    Thread Starter bearshang

    (@bearshang)

Viewing 15 replies - 31 through 45 (of 72 total)