How to always display full size image

Not a PHP solution, but below is a jQuery option. var images = $(‘.entry-content img’); images.each(function() { var src = $(this).attr(‘src’), // removes the img size off the src e.g -300×300. newsrc = src.replace(/-\d+[Xx]\d+\./,’.’); $(this).attr(‘src’,newsrc); }); You would need to remove some of the classes e.g size-thumbnail

Add ID to output only for first option

Instead of using an if check, use filter_var() so that any boolean-ish value can be passed in the shortcode attribute; e.g., yes, no, on, off, true, false, 0, 1. $no = filter_var( $no, FILTER_VALIDATE_BOOLEAN ); Now, $no is either true or false (boolean). Sorry, I see $no is actually a number. My mistake. if ( … Read more

add menu page in loop menu order

Ok it took me a while, but I think I have it. I had to use usort. I also included the code for the get_top_level_pages() method. $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array(‘post_type’ => ‘page’, ‘posts_per_page’ => ‘-1’)); $top_level_pages = get_page_by_title(‘Locations’); $menuArray = get_page_children( $top_level_pages->ID, $all_wp_pages ); function compareOrder($a, $b) { return $a->menu_order – $b->menu_order; … Read more

Theme editing “post thumbnail” help

Well, I have set the featured image or any other from post with this code: Get the image $image_id=get_post_thumbnail_id(get_the_ID()); $image_url = wp_get_attachment_image_src($image_id,’full’); $image_url=$image_url[0]; Set the image as background <div id=”full” class=”full float-left” style=”background-image:url(<?php get_image_url(); ?>);”> Your content here. </div> Next, one example I made few years ago taking the image from random post, the image … Read more

How save data on user’s client cache

wp_cache_* methods are cached in either php memory or an object cache ( if available ) . It will never be available to be saved in the browser. If you want to save it on the browser side, you’ll need to use JavaScript. Local or Session storage are great for that https://caniuse.com/#feat=namevalue-storage

My WP Website Shows HTTP ERROR 500

For future reference you could use the define( ‘WP_DEBUG’, true ); at your wp_config to easily spot errors and turn to false when you are done. Enabling WP_DEBUG will cause all PHP errors, notices and warnings to be displayed. This is likely to modify the default behaviour of PHP which only displays fatal errors and/or … Read more

WooCommerce Custom Tab with ACF Repeater Field

I believe you need to use get_sub_field() for the repeater field (designer_achievements) and get_field() for its parent. Please take a look at the ACF documentation for the Repeater field’s subfield. You will also need to use a have_rows() loop, as noted in the documentation. if( have_rows(‘parent_field’) ): while( have_rows(‘parent_field’) ) : the_row(); $value = get_sub_field(‘sub_field’); … Read more

(Who to follow) Twitter widget

It looks like you’re saving a PHP std object in the database. It might be an array, I’d have to check how WordPress saves those. In either case: If you’re using add_user_meta() or update_user_meta() to insert the user meta into the database (and you should be), then using get_user_meta() with the third parameter set to … Read more