Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter uhorcik

    (@uhorcik)

    Hi Jay, thanks for your answer. You were right debug.log gave me the answer it was a Call to undefined function bpfwp_setting() in the header file. I had to comment out any reference to this function which i use to display phone number via your plugin.

    Thread Starter uhorcik

    (@uhorcik)

    Skvele dakujem!

    Thread Starter uhorcik

    (@uhorcik)

    Dobry den,

    Dakujem za odpoved. Description funguje! No Nazov produktu sa stale neprepisuje. Pravdepodobne by to mohlo byt sposobene tym ze pouzivame plugin “Variation Swatches for WooCommerce”. V XML sa vytvaraju pre kazdy variant produktu osobitne Shopitemy s PRODUCTNAME = “Nazov produktu – variacia” (napr. Full Spectrum CBD Olej 10ml – 5% CBD a Full Spectrum CBD Olej 10ml – 10% CBD). Je aj v takomto pripade mozne prepisat Productname?

    Thread Starter uhorcik

    (@uhorcik)

    Thanks Paul, that works!

    Thread Starter uhorcik

    (@uhorcik)

    It did the magic, thanks a million!:)

    Thread Starter uhorcik

    (@uhorcik)

    @dcooney nope, sorry for not being specific. I have a separate AJAX callback function that refreshes the container with displayed post links whenever the dropdown filter changes its value. This container also contains “Load More” button generated by your plugin. This button hides and stops functioning when i change the filter value and the AJAX call of my filter function is called. Please see my callback function:

    
    <?php
    add_action( 'wp_ajax_nopriv_filter', 'filter_ajax' );
    add_action( 'wp_ajax_filter', 'filter_ajax' );
    
    function filter_ajax() {
    
        $category = $_POST['category'];
    
        $post_type = 'my_post_type';
        $taxonomy = 'my_taxonomy';
    
        $posts_per_page = '10';
        $args = array(
            'post_type'   => $post_type,
            'post_status' => 'publish',
            'posts_per_page'=> $posts_per_page
        );
    
        if(isset($category) && $category !== "") {
            $args['tax_query'] = array(array ('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $category,));
        }
    
        $articles = new WP_Query( $args );
        if( $articles->have_posts() ) :
            ?>
    
            <div class="columns">
                <?php
                while( $articles->have_posts() ) :
                    $articles->the_post();
                    ?>
    
                    <div class="article-box column">
    
                        <a href="<?php echo get_the_permalink() ?>">
                            <div class="box">
    
                                <h4>
                                    <?php
                                    $categories = get_the_terms($post, $taxonomy);
                                    if (!empty($categories)) {
                                        echo esc_html($categories[0]->name);
                                    }
                                    ?>
                                </h4>
                                <p><?php echo get_the_title() ?></p>
                            </div>
                        </a>
                    </div>
    
                <?php
                endwhile;
                echo do_shortcode('[ajax_load_more container_type="div" post_type="'.$post_type.'" taxonomy="'.$taxonomy.'" taxonomy_terms="'.$category.'" taxonomy_operator="IN" posts_per_page="'.$posts_per_page.'" pause="true" scroll="false" transition_container="false" button_label="Show More" offset="'.$posts_per_page.'" orderby="menu_order"]');
                ?>
            </div>
        <?php
        else :
            esc_html_e( 'No Articles found!', 'text-domain' );
        endif;
        wp_reset_postdata();
        die();
    }
    
    

    Please note that im a total noob in ajax and this is my first ever callback function

    Thread Starter uhorcik

    (@uhorcik)

    Yes i did that a multiple times :/

    Thread Starter uhorcik

    (@uhorcik)

    Yes but unfortunately even after selecting the template i still get 404

    Thread Starter uhorcik

    (@uhorcik)

    @dcooney thank you for your answer! It seems the problem isnt in wp_reset_query() as it takes no effect there at all. However a strange solution came in: i deleted all $do_not_duplicate logic and added order="ASC" and it now works as desired. Strange thing is that after asking for ascending order, posts now order themselves in descending fashion (as required). Maybe it has something to do with Simple Custom Post Order plugin im using, but anyway Im not looking forward to the future update that will fix this:D

    Thread Starter uhorcik

    (@uhorcik)

    @tw2113 Thank you for such a quick answer! I was afraid you would say that. Unfortunately using the default post template is not possible in my case and the taxonomy slug has to stay in the url. Isnt it possible to force the custom post type to skip looking for single-{…}.php files and instead grab a custom template file?

    I tried this but no effect:

    
    <?php
    /*
    Template Name: My Template Name
    Template Post Type: my_custom_post_type
    */
    ?>
    
Viewing 10 replies - 1 through 10 (of 10 total)