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

How to sort custom post’s category by id from the theme’s function.php?

You need to change the orderby to ID: $args=array( ‘class’ => ‘select-submit2’, ‘hide_empty’ => false, ‘selected’ => $prop_category_selected, ‘name’ => ‘prop_category’, ‘id’ => ‘prop_category_submit’, ‘orderby’ => ‘ID’, //this changed to ID ‘order’ => ‘ASC’, ‘show_option_none’ => __(‘None’,’wpestate’), ‘taxonomy’ => ‘property_category’, ‘hierarchical’=> true ); wp_dropdown_categories( $args ); ?>

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