Forum Replies Created

Viewing 15 replies - 1 through 15 (of 103 total)
  • In order to resolve this issue this is what I have done:

    1. Check for current language and set a variable accordingly:

    jQuery( document ).ready(function() {
    <?php if(ICL_LANGUAGE_CODE=='en'){ ?>
        lg = "en";
    <?php } ?>
    <?php if(ICL_LANGUAGE_CODE=='es'){ ?>
        lg = "es";
    <?php } ?>
    <?php if(ICL_LANGUAGE_CODE=='de'){ ?>
        lg = "de";
    <?php } ?>
    <?php if(ICL_LANGUAGE_CODE=='it'){ ?>
        lg = "it";
    <?php } ?>
    <?php if(ICL_LANGUAGE_CODE=='fr'){ ?>
        lg = "fr";
    <?php } ?>
    });

    2. On each post set a custom field with the language

    usp-custom-15 = fr
    usp-custom-15 = it
    usp-custom-15 = de
    usp-custom-15 = it
    usp-custom-15 = en

    3. Check for meta keys

    [ajax_load_more post_type='post' posts_per_page='1' transition='fade' transition_container='false' container_type='ul' pause='true' pause_override='true' meta_key='usp-custom-15' meta_value=lg meta_compare='IN' meta_type='CHAR' meta_relation='AND' button_label='+']

    Not it will search for posts with those met-keys and one of them was the language.

    • This reply was modified 7 years, 10 months ago by downfast.
    Thread Starter downfast

    (@downfast)

    hey no that’s fine man, thanks a lot

    Thread Starter downfast

    (@downfast)

    Resolved by using the callback functions provided

    $(function() {
      $.fn.almComplete = function(alm){
    $("#wiki").on('click', function(e) {
    			  var q = $(this).data('subject');
    			  $.getJSON("https://it.wikipedia.org/w/api.php?callback=?", {
    			    srsearch: q,
    			    action: "query",
    			    list: "search",
    			    format: "json"
    			  }, function(data) {
    			    $("#results").empty();
    			    $("#results").append("<p>Results for <b>" + q + "</b></p>");
    			    $.each(data.query.search, function(i, item) {
    			      $("#results").append("<div><a href='https://it.wikipedia.org/wiki/" + encodeURIComponent(item.title) + "'>" + item.title + "</a><br>" + item.snippet + "<br><br></div>");
    			    });
    			  });
    			});
      };
    })(jQuery);
    • This reply was modified 8 years, 4 months ago by downfast.
    Thread Starter downfast

    (@downfast)

    This is the full code (NOTE: I need to call it many times, so it isn’t just one shot)

            if(btnClick == true) {
                btnClick = false;
                var $shortCode = '<?php echo do_shortcode("[ajax_load_more post_type='post' pause='true' meta_key='country:year' meta_value='LOCATION:TIME' meta_compare='IN:IN' meta_type='CHAR:CHAR' meta_relation='AND' button_label='SPIMEING']"); ?>'
    
                $('.panel_block').html($shortCode);
    
                this.getElement().classList.add('active');
                jQuery(".panel_block").show(function(){
                    jQuery(".ajax-load-more-wrap ul").attr("data-meta-value", loc + ":" + date);
                    jQuery.fn.almTriggerClick();
                });
    
                setTimeout(
                    function() {
                        if ($(".ajax-load-more-wrap").length){
                            $(".ajax-load-more-wrap").ajaxloadmore();
                            
                        }
                }, 500);
    Thread Starter downfast

    (@downfast)

    I am having this:

    jQuery.fn.almTriggerClick is not a function(…

    When I do

                        if ($(".ajax-load-more-wrap").length){
                            $(".ajax-load-more-wrap").ajaxloadmore();
                            jQuery.fn.almTriggerClick();
                        }
    Thread Starter downfast

    (@downfast)

    p.s. it also adds:

    meta_compare="IN:IN" meta_type="CHAR:CHAR"

    Is it that ok if I am simply asking for text values to retunr?

    Thread Starter downfast

    (@downfast)

    Hey Darren
    actually I did look into it but id din’t see the button “add another”. Maybe some docs or some help text within the shortcode builder.
    Or maybe was just me, HI honestly missed it.

    Thanks a lot

    Thread Starter downfast

    (@downfast)

    p.s. The values comes from 2 different advanced custom fields:

    year
    country

    And the post must be related with the 2 fields, if the post doesn’t match, it shouldn’t appear.

    	function panelShow(e) {
                    var date = <?php the_field("year"); ?>
                    var date = <?php the_field("country"); ?>
    		jQuery(".panel_block").show();
    		if (jQuery(".panel_block:not(:empty)").length) {
    			jQuery("#ajax-load-more ul").attr("data-meta-key", loc + ", " + date);
    		}
    		setTimeout(
      			function() {
        				jQuery.fn.almTriggerClick();
      		}, 1000);
    		
    	}
    <div class="panel_block">
    	<?php echo do_shortcode('[ajax_load_more pause="true" meta_key="country, year" meta_value="value1, value2" post_type="post"]'); ?>
    </div>
    • This reply was modified 8 years, 4 months ago by downfast.
    • This reply was modified 8 years, 4 months ago by downfast.
    Thread Starter downfast

    (@downfast)

    Sorry for the clearity:

    I have updated the plugin but the site wasn’t loading as jQuery is missing, any idea why is it happening?

    Not error at all but in console it is saying jQuery not recognised and site won’t load its content as it’s like jQuery is missing but it is there, maybe is the plugin js position which is before wp jquery

    I

    Thanks

    downfast

    (@downfast)

    Oh well guess what? I simply added .text(“Finished”) where you add the class .done in the core js. At least the user will be advised somehow that there are not more to load. The repeater is fine as I get even a validation from w3c as html5. So i don’t think, but i might be wrong tho, that is the issue with the hidden button.

    downfast

    (@downfast)

    OK sent an email via your connekthq site

    downfast

    (@downfast)

    hehe ??

    Alright man, what’s your email? Do you need wp account details too?

    p.s. today i bought multi repeater plugin and preload plugin too, i’m a bit confused with the preload as i didn’t get what it really does but will take e this in another discussion.

    downfast

    (@downfast)

    Ok my repeater has html, and it is what you see below. Unless you find an error which i miss and we can solve it, I was going to do another test. Count the total number of post in a category and do a check with js in the dom and see if these numbers matches or not in order to test what you said before.

    <?php
    global $post;
    ?>
    
    <div class="item needsclick  <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; }?> col-xs-12
        <?php if( get_field('big') ) { ?>
            col-sm-8 col-md-8 col-lg-6
        <?php } else { ?>
            col-sm-4 col-md-4 col-lg-3
    	<?php } ?>"
    		data-client="<?php
    		foreach((get_the_category()) as $childcat) {
    			if (cat_is_ancestor_of(37, $childcat)) {
    				echo $childcat->cat_name;
    			}
    		}?>" data-agency="<?php
    		foreach((get_the_category()) as $childcat) {
    			if (cat_is_ancestor_of(36, $childcat)) {
    			 	echo $childcat->cat_name;
    			}
    		}?>" data-year="<?php
    		foreach((get_the_category()) as $childcat) {
    			if (cat_is_ancestor_of(38, $childcat)) {
    			    $Value= $childcat->cat_name;
    			    $str= ltrim ($Value, 'y');
    			    echo $str;
    			}
    		} ?>" data-skills="<?php
    		foreach((get_the_category()) as $childcat) {
    			if (cat_is_ancestor_of(45, $childcat)) {
    			    echo $childcat->cat_name;
    			}
    		}
    ?>">
    	<div class="cover hidden-xs"><p>Loading..</p></div>
    	<div class="thumbnail">
    	 <?php the_post_thumbnail('big', array( 'class'	=> "img-responsive")); ?>
    
    	<div class="caption hidden-xs">
    
    	    <p>
            <?php the_title(); ?>
    	    <br><?php
    	        foreach((get_the_category()) as $childcat) {
    	            if (cat_is_ancestor_of(37, $childcat)) {
    	                echo $childcat->cat_name;
    	            }
    	        }
            ?>
    	    </p>
    
    	</div>
    
    	<div class="wrapVideo">
                <div class="embed-responsive embed-responsive-16by9">
                    <span class="video" data-vimeoid='<?php
    					the_field("video"); ?>'>
    				</span>
                </div>
    			<div class="infoBox">
                        <ul class="hidden-xs options clearfix combo-filters">
    
    			            <li class="option-combo client">
    			            	 <span class="filter option-set" data-filter-group="client">
    
    			               <a id="filter-client-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" href="#filter-client-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-client="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"
                                   data-agency="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"
    			                    data-skills="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"
    			                    data-year="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                        if (cat_is_ancestor_of(38, $childcat)) {
    			                            $Value= $childcat->cat_name;
    			                            $str= ltrim ($Value, 'y');
    			                            echo $str;
    			                        }
    			                    }
    			                    ?>" data-filter-value=".<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" class="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"><span class="label label-info"><?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name; }} ?></span></a> 
    
    			                </span>
    			            </li>
    
    			            <li class="option-combo skills">
    			            	<span class="filter option-set" data-filter-group="skills">
    
    			                <a id="filter-skills-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" href="#filter-skills-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-client="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"
                                   data-agency="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-skills="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-year="<?php
    			                                foreach((get_the_category()) as $childcat) {
    			                                    if (cat_is_ancestor_of(38, $childcat)) {
    			                                        $Value= $childcat->cat_name;
    			                                        $str= ltrim ($Value, 'y');
    			                                        echo $str;
    			                                    }
    			                                }
    			                    ?>" data-filter-value=".<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" class="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"><span class="label label-info"><?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(45, $childcat)) {
    			                     echo $childcat->cat_name; }} ?></span></a> 
    
    			                </span>
    			            </li>
    
    	            		<li class="option-combo agency">
    	            			<span class="filter option-set" data-filter-group="agency">
    
    			                <a id="filter-agency-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" href="#filter-agency-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-client="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-agency="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-year="<?php
    			                                foreach((get_the_category()) as $childcat) {
    			                                    if (cat_is_ancestor_of(38, $childcat)) {
    			                                        $Value= $childcat->cat_name;
    			                                        $str= ltrim ($Value, 'y');
    			                                        echo $str;
    			                                    }
    			                                }
    			                    ?>" data-filter-value=".<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" class="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"><span class="label label-info"><?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name; }} ?></span></a>
    			                </span>
    	            		</li>
    			            <li class="option-combo year">
    			            	<span class="filter option-set" data-filter-group="year">
    
    			                	<a id="filter-year-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(38, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" href="#filter-year-<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(38, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-client="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(37, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-agency="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(36, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" data-year="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                        if (cat_is_ancestor_of(38, $childcat)) {
    			                            $Value= $childcat->cat_name;
    			                            $str= ltrim ($Value, 'y');
    			                            echo $str;
    			                        }
    			                    }
    			                    ?>" data-filter-value=".<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(38, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>" class="<?php
    			                    foreach((get_the_category()) as $childcat) {
    			                    if (cat_is_ancestor_of(38, $childcat)) {
    			                     echo $childcat->cat_name;
    			                    }}
    			                    ?>"><span class="label label-info"><?php
    			                    foreach((get_the_category()) as $childcat) { if (cat_is_ancestor_of(38, $childcat)) {
    			                    $Value= $childcat->cat_name;
    			                    $str= ltrim ($Value, 'y');
    			                    echo $str; }} ?></span></a>
    			                </span>
    			            </li>
                		</ul>
    
               <hr>
                <p><?php echo the_field("riassunto"); ?></p>
                             </div>
            </div>
    	</div>
    </div>

    downfast

    (@downfast)

    It counts the Dom elements vs The total elements of the category posts?

    downfast

    (@downfast)

    Any category I try I get the same result with the button not adding the .done.

    Maybe I need to add to better specify that when I click.. the button queries..doesn’t finds any..and it does add the .done class. But what If in my case, the plugins auto loads the posts on page load, and once the posts are loaded, the button should know if there anymore or not without the need to click to have 0 new results and finally have the .done class.

Viewing 15 replies - 1 through 15 (of 103 total)