Blob file download problem
There are some security issues. Please sanitize your input because someone can download from Your database something different than archive, or simply drop Your database. $fid = sanitize_text_field( $_GET[‘fid’] );
There are some security issues. Please sanitize your input because someone can download from Your database something different than archive, or simply drop Your database. $fid = sanitize_text_field( $_GET[‘fid’] );
The <a> tag is the wrong tag for a submit button. <input type=”submit”> and <button> are designed for this purpose. An <a> tag won’t even submit the form data. You need to change your HTML to accommodate this fact.
Just wrap it all in an ! is_admin() check: add_filter( ‘wp_setup_nav_menu_item’,’decorate_mobile_menu’ ); function decorate_mobile_menu($item) { if ( ! is_admin() ) { if ( strpos($item->title, ‘SHIPPING’) !== false) { $split = explode(” IN “, $item->title); $item->title=”<span class=”shipping-menu-item”>” . $split[0] . ‘ IN </span>’; $item->title .= ‘<br/>’; $item->title .= ‘<span class=”shipping-menu-item”>’ . $split[1] . ‘</span>’; } } … Read more
Preblem is because inside loop you have UL echo ‘<ul>’; while ( $loop->have_posts() ) : $loop->the_post(); ?> <li data-transition=”fade” data-slotamount=”6″> <?php echo wp_get_attachment_image( get_post_thumbnail_id(), ‘full’, false, array( ‘class’ => ‘thumbnail zoom’ ) );?> <p><a href=”#.”><?php the_title();?></a></p> </li> <?php endwhile;echo ‘</ul>’; Just make one IF statment before echo-ing UL tag $loop = new WP_Query( $args ); … Read more
If it is not HTML, it does not need HTML escaping, if it is not JS, it does not need JS escaping. All escaping is context based. In general You should probably just avoid sending “text” in response and focus on sending data which is “converted” into whatever is the relevant DOM structures, either directly … Read more
You can add a php variable and increment it every time the while loop runs $args = array( ‘post_type’ => ‘events’, ‘order’ => ‘ASC’, ); $wp_query = new WP_Query($args); ?> <script type=”application/ld+json”> { “@context”:”http://schema.org”, “@type”:”ItemList”, “itemListElement”:[ <?php $i=0; while ( have_posts() ) : the_post(); $i++; ?> { “@type”:”ListItem”, “position”:”<?php echo $i; ?>”, “url”:”<?php the_permalink(); ?>” … Read more
For some reason, your $subject variable is empty when you call get_the_content($post_id). When using save_post hook, you can pass additional arguments like $post and $update to your callback. For your case, you could use the second argument $post to grab the post contents. Code: function save_url_link( $post_id, $post ){ $pattern = “/(http|https):\/\/.*\/(.*)\.(mp3|m4a|ogg|wav|wma)/”; $subject = $post->post_content; … Read more
I suppose it deleted the value when you had no URL in the content, so $audio_raw was empty. if ($audio_raw && get_post_meta( $post_id, ‘audio_url’, true ) != $audio_raw) { // update the meta field update_post_meta( $post_id, ‘audio_url’, $audio_raw ); } checks that $audio_raw isn’t false/null/empty and that $audio_raw isn’t the same as the string currently … Read more
The common mistake people make in this situation is they start to introduce bunch of custom counters to keep track of state. Really WP_Query just has those already. In your case that would be global $wp_query and $wp_query->post_count and $wp_query->current_post. That should be quite enough to figure out even/odd overall and current iteration in the … Read more
Chances are your pager is getting the count of all posts, regardless of whether they are published. In your query, you should add a filter for only published posts. $query_args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 4, ‘paged’ => $paged, ‘post_status’ = ‘publish’, ); Then the results count and number of pager links should … Read more