Adding a search form inside a div
The get_search_form() echos so it will always show up before returns. Use: get_search_form( false )
The get_search_form() echos so it will always show up before returns. Use: get_search_form( false )
The solution below will parse the comma separated values passed to the shortcode’s type parameter. We’ll also strip out any whitespace surrounding the values which is a usability improvement (see example 2 after the code below). add_shortcode( ‘related’, ‘wpse_related’ ); function wpse_related( $atts, $content=”” ) { // User provided values are stored in $atts. // … Read more
You have to use a string as key: $menu[‘26.0648’][0] = ‘Event Calendar’; If you write the key as a number, it will truncate the decimal to an integer, so 26.0648 will be truncated to 26.
You cannot save raw PHP inside post content, it gets cleaned out on save. This is an obvious security precaution. However, there are plugins that will enable you to do this, for example: http://wordpress.org/extend/plugins/allow-php-in-posts-and-pages/ This is not recommended though, better solution would be to create a generic shortcode for your from.
You could run a check on the save_post hook, but WooCommerce already has a hook for processing meta where the post type and security checks have already been done. So using their hook, you just check for a null string on the regular price and set it to 0. function wpa104760_default_price( $post_id, $post ) { … Read more
WordPress doesn’t use PHP sessions, so WordPress itself can not be related with your sessions working or not regarding if you are logged in or not (I think). Try to call session_start() on init action instead of doing it in a template file and be sure it is called before your custom library is loaded. … Read more
Query vars are for use in the main $wp_query query object, your custom admin page has no main query, so no vars are parsed into a query object that can be accessed via get_query_var. I don’t think there’s anything WordPress-specific that can be used in this case, I would just access the value via $_GET.
Wordfence blocks the User endpoint from the public. In settings there is a checkbox you can unselect to make it visible in the WP Rest API again.
The first step is setting up the cron job. The second part requires querying the database for a specific post type where the entry is older than 1 week. We can do this with get_posts() and specifying the category argument and the date_query argument. //* If the scheduled event got removed from the cron schedule, … Read more
That button sends an AJAX request that runs wp_ajax_destroy_sessions(). It’s not really abstracted in such a way that you can re-use it outside of AJAX, but if you copy the source into your own function, minus the JSON parts, then you could perform the same action yourself. The key part is this bit, which will … Read more