Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Daniel Semblano

    (@dsemblano)

    A temporary fix:
    responsive-lightbox.php file, 645 line:

    load_plugin_textdomain( 'responsive-lightbox', false, dirname( RESPONSIVE_LIGHTBOX_BASENAME ) . '/languages' );

    Wrap it with the following hook:

    add_action('init', function () {
    load_plugin_textdomain( 'responsive-lightbox', false, dirname( RESPONSIVE_LIGHTBOX_BASENAME ) . '/languages' );
    });

    Same problem here, “Instagram has returned invalid data”.

    I did some research and my guess this link bellow from Linnea explains everything:

    https://www.linsoftware.com/wordpress-has_post_thumbnail-not-working-fix-phantom-featured-image-issue/

    “The typical way to check for whether a WordPress post has a featured image is to use the function has_post_thumbnail() This function calls get_post_thumbnail_id(), which queries the database for the post meta field _thumbnail_id.

    If the field _thumbnail_id is not empty, has_post_thumbnail() will return true.

    has_post_thumbnail() does not actually check to see whether _thumbnail_id is an actual ID of an object that exists in your database. So, on the rare occasion, has_post_thumbnail() will return true when the post thumbnail does not actually exist.”

    For me, using the function wp_get_attachment_url instead of has_post_thumbnail() and checking the result if is not empty worked as desirable:

    $featured_image_url = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) );
    
    if  ( ! empty( $featured_image_url ) ) {
    
         // do a bunch of stuff
    
    }

    I can confirm this same problem and situation (have imported posts from a previous wordpress install).

    I’m using Sage theme with Trellis, switched to another theme but no luck, it only shows a default thumbnail when I had set a featured image before. I’ve disabled all plugins too and i’m only using default post type.

    I can confirm that, last version 1.0.8 is broken.

    Warning: Invalid argument supplied for foreach() in /var/www/html/wordpress-site/wp-content/plugins/instagram-image-gallery/db.class.php on line 232.

    The Generate your Instagram widget don’t save anything when you attempt to save.

    Same problem here, I had downloaded from github and still doesn’t work the mask for repeater field, using text for field type.

    I can confirm that, I have the two plugins, I did remove my entire code from header.php (as I didn’t find an option in Google Analytics WP to not insert the code) and everything is fine. Thank you Joost!

    Thread Starter Daniel Semblano

    (@dsemblano)

    I can confirm too. Works great ??

    Thread Starter Daniel Semblano

    (@dsemblano)

    Sorry for the delay in replying. Thank you very much indeed vtxyzzy! This is exactly what I was looking for, the query works like a charm!

    Here is how the final code became in functions.php, if any kind of help for further reference:

    function restaurant_search( $taxonomy ) {
    	?>
    	<script type="text/javascript">
    		jQuery(document).ready(function() {
    			$('#cidade').change(function(){
    			var cidade=jQuery('#cidade').val();
    				$.ajax({
    					url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",
    					type:'POST',
    					data:'action=category_select_action&name=' + cidade,
    					success:function(results)
    					{
    					$("#cozinha").html(results);
    					}
    				 });
    			});
    		});
    	</script>
    
    <form action="<?php echo home_url('/'); ?>" role="search" method="get">
    	<?php // First dropdown
    		$term_selected_cidade = get_terms('cidade');
    		echo '<select id="cidade" name="cidade">';
    		echo '<option disabled="disabled" selected="selected">Cidade</option>';
    		foreach ($term_selected_cidade as $term) {
    			echo '<option id=' . $term->term_id . ' value=' . $term->slug . '>' . $term->name . '</option>';
    		}
    		echo '</select>';
    
    	?>
    
    	<!-- Second Dropdown -->
    	<select name="cozinha" id="cozinha" >
    		<option>Escolha uma cidade</option>
    	</select>
    	<input type="submit" value="buscar" />
    </form>
    
    <?php }
    
    function implement_ajax() {
    	// Populates the second dropdown with cuisine terms
    	global $wpdb;
    	$cozinha_term = $_POST['name'];
    	$query = "
    		SELECT DISTINCT $wpdb->terms.name, $wpdb->terms.slug
    		FROM $wpdb->terms
    		INNER JOIN $wpdb->term_taxonomy ON $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id
    		INNER JOIN $wpdb->term_relationships ON $wpdb->term_relationships.term_taxonomy_id=$wpdb->term_taxonomy.term_taxonomy_id
    		LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->term_relationships.object_id
    		WHERE $wpdb->term_taxonomy.taxonomy='cozinha' AND $wpdb->posts.ID IN (
    		SELECT $wpdb->posts.ID
    		FROM $wpdb->terms
    		INNER JOIN $wpdb->term_taxonomy ON $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id
    		INNER JOIN $wpdb->term_relationships ON $wpdb->term_relationships.term_taxonomy_id=$wpdb->term_taxonomy.term_taxonomy_id
    		LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->term_relationships.object_id
    		WHERE $wpdb->term_taxonomy.taxonomy='cidade' AND $wpdb->terms.slug='$cozinha_term')";
    
    	$object = $wpdb->get_results($query);
    	$cuisine_terms = array();
    	for ($i = 0; $i < count($object); $i++) {
    		$cuisine_terms[] = get_object_vars($object[$i]);
    	}
    
    	echo '<select id="cozinha">' . '<option disabled="disabled" selected="selected">Cozinha</option>';
    	foreach ($cuisine_terms as $term) {
    		echo '<option value=' . $term['slug'] . '>' . $term['name'] . '</option>';
    	}
    	echo '</select>';
    }
    
    add_action('wp_ajax_category_select_action', 'implement_ajax');
    add_action('wp_ajax_nopriv_category_select_action', 'implement_ajax');
    Thread Starter Daniel Semblano

    (@dsemblano)

    I’m trying to figure out the query, so I’ve got only half the way:

    SELECT * FROM wp_terms AS wt
    INNER JOIN wp_term_taxonomy AS wtt ON wt.term_id=wtt.term_id /* Juntando tabela de taxonomias */
    INNER JOIN wp_term_relationships AS wtr ON wtr.term_taxonomy_id=wtt.term_taxonomy_id /* Juntando tabela de relationships */
    LEFT JOIN wp_posts wp ON wp.ID=wtr.object_id
    WHERE taxonomy='cidade' AND slug='recife'
    ORDER BY name
    Thread Starter Daniel Semblano

    (@dsemblano)

    Hi vtxyzzy, thank you for replying, any help is appreciate. I’m not yet using a raw query, I’m just using a custom function in my functions.php. This function creates two dropdowns (city and cuisine terms) and populate (via ajax) the second dropdown with cuisine terms. The terms I didn’t translate, so ‘cidade’ means ‘city and ‘cozinha’ means ‘cuisine’:

    function restaurant_search( $taxonomy ) {
    	?>
    	<script type="text/javascript">
    		jQuery(document).ready(function( $ ) {
    			$('#cidade').change(function(){
    				$.ajax({
    					url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",
    					type:'POST',
    					data:'action=category_select_action&name=' + name,
    					success:function(results)
    					{
    					$("#cozinha").html(results);
    					}
    				 });
    			});
    		});
    	</script>
    
    <form action="<?php echo home_url('/'); ?>" role="search" method="get">
    	<?php // First dropdown
    		$term_selected_cidade = get_terms('cidade');
    		echo '<select id="cidade" name="cidade">';
    		echo '<option disabled="disabled" selected="selected">Cidade</option>';
    		foreach ($term_selected_cidade as $term) {
    			echo '<option value=' . $term->slug . '>' . $term->name . '</option>';
    		}
    		echo '</select>';
    	?>
    
    	<!-- Second Dropdown -->
    	<select name="cozinha" id="cozinha" ><option>Escolha uma cidade</option></select>
    	<input type="submit" value="buscar" />
    </form>
    <?php }
    
    function implement_ajax() {
    	// Populates the second dropdown with cuisine terms
    	$term_selected_cozinha = get_terms('cozinha');
    	echo '<select id="cozinha">';
    	echo '<option disabled="disabled" selected="selected">Cozinha</option>';
    	foreach ($term_selected_cozinha as $term) {
    		echo '<option value=' . $term->slug . '>' . $term->name . '</option>';
    	}
    	echo '</select>';
    }
    
    add_action('wp_ajax_category_select_action', 'implement_ajax');
    add_action('wp_ajax_nopriv_category_select_action', 'implement_ajax');
Viewing 12 replies - 1 through 12 (of 12 total)