Thomas
Forum Replies Created
-
Hi, it’s a site of a costumer. So I can’t give you the login. Isn’t there another way you can figure this out? The only thing I did is copy the form and used that shortcode on a different spot. So in my opinion it should work.
Thomas
Forum: Plugins
In reply to: [Send PDF for Contact Form 7] Current version causes fatal errorDon’t worry, just mentioning it so you can solve it! Thought it would be useful.
Forum: Plugins
In reply to: [Drag and Drop Multiple File Upload for Contact Form 7] Not working.Hi,
Yeah, for this form it worked! So that’s good. But I think the problem will still remain when I create a new one. The styling doesn’t show properly then, but I’ll look into that later.
Thank you.
Forum: Plugins
In reply to: [Drag and Drop Multiple File Upload for Contact Form 7] Not working.Well, the styling was changed all of the sudden, because the html structure was changed. Also, now every file isn’t uploading, because the file size is “too big”. But I’ve set the file size to 20mb.
I found this out when I created a new tag in another form. It suddenly was completely different from the forms that actually worked with this plugin. Don’t know where it went wrong.
@chouby Wow you’re right, didn’t even know that was an option. Maybe a co-worker enabled that or so. Thank you!
My current functions.php looks like this:
function misha_filter_function(){ if ( ! array_key_exists('newsfilter', $_POST)) exit; $tag_id = (int) $_POST['newsfilter']; $tax_query = array( array( 'taxonomy' => 'post_tag', 'field' => 'term_id', 'terms' => $tag_id, ), ); $args = array( // any other query criteria here 'tax_query' => $tax_query, ); $the_query = new WP_Query( $args ); if( $the_query->have_posts() ) : while( $the_query->have_posts() ): $the_query->the_post(); ?> <!-- post --> <div class="news col-md-6"> <a href="<?php the_permalink();?>"> <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?> <div class="featered" style="background-image:url('<?php echo $thumb['0'];?>');"></div> <div class="title"> <p class="date"><?php echo get_the_date();?></p> <?php add_filter( 'the_title', 'max_title_length');?> <h4><?php the_title(); ?></h4> </div> </a> </div> <?php endwhile; wp_reset_postdata(); else : echo 'Geen resultaten, probeer het opnieuw.'; endif; die(); } add_action('wp_ajax_myfilter', 'misha_filter_function'); add_action('wp_ajax_nopriv_myfilter', 'misha_filter_function');Okay, I’ve now added your code and got the newsfilter working. The other filters don’t work now.
I had one problem with your code. The loop you included doesn’t work:
if ( $the_query->have_posts() ) { echo '<ul>'; while ( $the_query->have_posts() ) { $the_query->the_post(); echo '<li>' . get_the_title() . '</li>'; } echo '</ul>'; exit; } else { echo 'Nothing found, try again'; exit; }So I sticked with my own:
$query = new WP_Query( $args ); if( $query->have_posts() ) : while( $query->have_posts() ): $query->the_post(); ?> <!-- post --> <div class="news col-md-6"> <a href="<?php the_permalink();?>"> <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?> <div class="featered" style="background-image:url('<?php echo $thumb['0'];?>');"></div> <div class="title"> <p class="date"><?php echo get_the_date();?></p> <?php add_filter( 'the_title', 'max_title_length');?> <h4><?php the_title(); ?></h4> </div> </a> </div> <?php endwhile; wp_reset_postdata(); else : echo 'Geen resultaten, probeer het opnieuw.'; endif; die(); }So, how do I go on with this so I can make all filters work? Thank you for your help.
Thank you for your reply. My php knowledge is quite minimal. Often I apply “simpler” code to my WordPress websites. So it sounds quite silly from me if I say I do not get what you are explaining. Any chance there is another way so a php noob like me can understand?
My current form selection looks like this:
<form action="<?php echo site_url() ?>/wp-admin/admin-ajax.php" method="POST" id="newsfilter"> <?php if( $terms = $terms = get_terms( array('term_taxonomy_id' => array(87, 88, 89), 'post_type' => 'post' ) ) ): // to make it simple I use default categories echo '<select name="newsfilter"><option>Filteren op:</option>'; foreach ( $terms as $term ) : echo '<option value="' . $term->term_id . '">' . $term->name . '</option>'; // ID of the category as the value of an option endforeach; echo '</select>'; endif; ?> <button id="filterbutton">Filter</button> <input type="hidden" name="action" value="myfilter"> </form>Forum: Fixing WordPress
In reply to: Can’t publish in WordPress 5.0 – 5.1.1.Yes, I’ve also tried switching themes. Didn’t work unfortunately. Screenshot won’t be necessary. I just get the simple error in red on top of my page: “Publiceren mislukt”, which in English means: “Publish Failed”.
Forum: Fixing WordPress
In reply to: Link opens in new tab not working: #new_tab behind url.Yeah I’m aware of that.
Forum: Fixing WordPress
In reply to: Link opens in new tab not working: #new_tab behind url.Sorry, I forgot to mention. It’s about the “Page Links To” plugin.
Forum: Fixing WordPress
In reply to: Comment section not showing up while enabledI’m sorry I respond this late, because I fixed the problem.
I followed a tutorial and swapped the order of the comments and the textarea. Swapping them back did the trick. Thanks anyway!