Change post count on tag/terms pages to 10

You’re almost there my friend. Just check with $query->is_tag() rather than only is_tag(). So your updated code will be- function main_query_mods( $query ) { // check http://codex.wordpress.org/Conditional_Tags to play with other queries if(!$query->is_main_query()) { return; } if($query->is_tag()) { $query->set(‘posts_per_page’,10); } } add_action( ‘pre_get_posts’, ‘main_query_mods’ );

WordPress – Custom Nav menu for logged in users – Shopkeeper theme

I think you already did part of this but i am detailing all steps: 1.- Register 2 nav menus: register_nav_menus(array( ‘logged-in’ => __(‘Logged In Menu’, ‘yourthemename’), ‘logged-out’ => __(‘Logged Out Menu’, ‘yourthemename’) )); 2.- Create the menus going to Appearence -> Menus in the back-end, assign each one to his corresponding location. 3.- Where you … Read more

Disable links to images only if link is an image

I am not a professional when it comes to regular expressions but this should be able to catch all linked images which the href attribute links to an image file ((png|jpg|gif|jpeg|bmp) feel free to add/remove extensions): add_filter(‘the_content’, function($c){ return preg_replace_callback(“#<\s*?a\b[^>]*>(.*?)</a\b[^>]*>#s”, function($m){ $tpl = $m[0]; $cnt = isset($m[1]) ? $m[1] : null; if ( preg_match(‘/<a(.*?)?href=[\'”]?.+\.(png|jpg|gif|jpeg|bmp)[\'”]?(.*?)?><\/a>/i’, str_replace($cnt, … Read more

Shortcode Function – Can’t get anything else to return after running shortcode within shortcode

You shouldn’t call return twice in a function, as it isn’t supported and only the first return is evaluated. What you can do is assign the first do_shortcode to a variable and return the variable concatenanted to the second return. function youtube_media_shortcode() { $shortcode_output = do_shortcode( ‘[x_video_embed no_container=”true”]<iframe width=”560″ height=”315″ src=”‘.get_field(‘youtubeurl’, ‘option’).'” frameborder=”0″ allowfullscreen></iframe>[/x_video_embed]’ ); … Read more

Frontend Feature image upload not work

Use the following code. <?php // Upload image to wordpress media and save image url to custom field. if(isset($_FILES[‘images’])) { // These files need to be included as dependencies when on the front end. require_once( ABSPATH . ‘wp-admin/includes/image.php’ ); require_once( ABSPATH . ‘wp-admin/includes/file.php’ ); require_once( ABSPATH . ‘wp-admin/includes/media.php’ ); require_once( ABSPATH . ‘wp-admin/includes/admin.php’ ); $file_return … Read more

Get child-pages slugs of current page into js-file

I just found what is arguably a cleaner way to do this…thanks to this other WPSE question How do I add a php statement to a jQuery string. I never new about wp_localize_script() until reading the answer to that question (I love WPSE :-). PHP add_action (‘wp_enqueue_scripts’, ‘localize_js’) ; function localize_js () { global $post … Read more