How to compare number with id of post in certain category

I found the solution <?php $costumepost = “12709”; // args $args = array( ‘numberposts’ => -1, ‘post_type’ => ‘post’, ‘cat’ => array(18), ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘costumeid’, ‘value’ => $costumepost, ‘compare’ => ‘=’ ), ) ); // query $the_query = new WP_Query( $args ); ?> <?php if( $the_query->have_posts() ): ?> … Read more

Unable to access WP test site

WordPress stores the site URL in a few places in the database in serialized arrays, which can break if you do a simple search & replace on the database. You need to use a tool like this which is aware of serialized arrays to do the replacement. You can bypass the broken URLs enough to … Read more

Multisite – Display different header content based on which site is accessed

You can use options to customize this for every site. Options are stored separately for each site. So, inside your header you can do something like <?php $login_link = get_option(“worduoso_login_link”); $login_text = get_option(“worduoso_login_text”); ?> and then print it like this <?php if($login_link && $login_text): ?> <div class=”added-header”><a href=”https://wordpress.stackexchange.com/questions/273810/<?php echo $login_link; ?>”><?php echo $login_text; ?></a></div><?php endif; … Read more

WooCommerce Variation Swatches and Photos – get attribute thumbnail

I resolved it by using get_woocommerce_term_meta $terms = get_terms( array( ‘taxonomy’ => ‘pa_texture’, ‘hide_empty’ => false, )); foreach ( $terms as $term ) : $thumbnail_id = get_woocommerce_term_meta( $term->term_id, ‘pa_texture_swatches_id_photo’, true ); $textureImg = wp_get_attachment_image_src( $thumbnail_id, ‘full’ ); ?> <img src=”https://wordpress.stackexchange.com/questions/274247/<?php echo $textureImg[0]; ?>”> endforeach;

dynamic image path within a javascript file

If you’re in JS you can’t use PHP (<?php ?>), you need to another way to get a PHP variable into JS. The normal way with WordPress is to use wp_localize_script(). wp_localize_script( ‘wpse_274344’, ‘myScriptObject’, array( ‘markerImageUrl’ => get_theme_file_uri( ‘/img/mapmarker.png’ ), ) ); Add that code after your call to wp_enqueue_script() or wp_register_script(). Replace wpse_274344 with … Read more