Can i put my shortcode inside a variable in php files?
You need to call do_shortcode(), as in: $check_in = do_shortcode (‘[st_custom_meta key=”st_custom_available_dates”]’) ;
You need to call do_shortcode(), as in: $check_in = do_shortcode (‘[st_custom_meta key=”st_custom_available_dates”]’) ;
File name should be admin-ajax.php This file handles all the ajax requests. So, you should never remove this file. Many features will stop working like autosave and many other that uses ajax if you remove this file.
Rather than attempting to modify a core file of woocommerce, make use of their filter hook. First of all, make sure you are using an up to date version of woocommerce. From the woocommerce documentation Add a custom currency / symbol: To add a custom currency in WooCommerce 2.0+, copy and paste this code in … Read more
Do not use globals. Ever. You don’t need your object everywhere. You need it only where your code is running. Globals are hard to debug, everyone can write to them or just delete them. Unit tests with globals are possible, but awkward. You have to change the global state for each test, ie. something outside … Read more
I think you’re looking for the img_caption_shortcode_width filter, within the img_caption_shortcode(): /** * Filters the width of an image’s caption. * * By default, the caption is 10 pixels greater than the width of the image, * to prevent post content from running up against a floated image. * * @since 3.7.0 * * @see … Read more
You need to add a the edit_published_posts capability for the contributor role in the functions.php add_filter(‘init’, function () { $role = get_role(‘contributor’); $role->add_cap(‘edit_published_posts’); });
Yes, it is possible. <?php $post_tags = get_the_tags(); if ($post_tags) { foreach($post_tags as $tag) { echo ‘<a href=”‘; echo bloginfo(); echo ‘/?tag=’ . $tag->slug . ‘” class=”‘ . $tag->slug . ‘”>’ . $tag->name . ‘</a>’; } } ?> The code is from another answer on Stack Overflow, see here for the source and more info
You can use a filter to remove height and width attributes from images, as explained in this CSS Tricks. Place the following in your themes functions.php file. add_filter( ‘post_thumbnail_html’, ‘remove_width_attribute’, 10 ); add_filter( ‘image_send_to_editor’, ‘remove_width_attribute’, 10 ); function remove_width_attribute( $html ) { $html = preg_replace( ‘/(width|height)=”\d*”\s/’, “”, $html ); return $html; }
home.php is the file in the WordPress template hierarchy which is used for the posts page. However, after looking at the Twentyseventeen theme code on GitHub, there is no home.php file provided which means the index.php will be used instead. Within index.php Twentyseventeen then uses get_template_part to seperate reusable sections of code. The most general … Read more
What you want is the normal behaviour if you register a taxonomy to multiple post types. What you appear to have done here is register a new Category taxonomy for your Celebrity post type. To add the default Category taxonomy to a post type use register_taxonomy_for_object_type(). register_taxonomy_for_object_type( ‘category’, ‘celebrity’ );