Getting a 404 on single custom post type page when using rewrite on a custom taxonomy

Add priority with at least 1 to your add actions: add_action( ‘init’, ‘add_training_post_type’, 1 ); add_action( ‘init’, ‘create_training_taxonomies’, 1 ); Currently your issue is that your post type and taxonomy rewrite slugs are identical, so the URL base would be the same and it confuses WP. Fortunately there is easy solution, just add this code … Read more

To make some div display for a longer time

Since WordPress 3.5, there are build in time constants to make thing easier for you. They are MINUTE_IN_SECONDS HOUR_IN_SECONDS DAY_IN_SECONDS WEEK_IN_SECONDS YEAR_IN_SECONDS You can probably do 30 DAY_IN_SECONDS for a 30 day period or 4 WEEK_IN_SECONDS for a 4 week period. Obviously, for a 2 month period you will do 60 DAY_IN_SECONDS

Fetching $_POST from Page Template into functions.php

Assign the value of you $_POST variable to a html element or javascript variable in front-page.php like //html element <input type=”hidden” value=”<?= $_POST[‘variable’]?>” id=”post-variable”> or in javascript variable var postVariable = “<?= $_POST[‘variable’]?>”; Now in ajax call, you can get the value as var myValue = jQuery(‘#post-variable’).val(); //if you set value to html element or … Read more

previous_post_link inside of a function?

previous_post_link() and next_post_link() should work inside the the_content filter. There is nothing wrong with your code except you must return the value inside the filter instead of print. Otherwise I believe post link should be there at the beginning of content. previous_post_link() and next_post_link() print the output so consider using get_previous_post_link() and get_next_post_link(). function prevnext( … Read more

Echo multiple tasks if a common function exists

As @Howdy_McGee mentioned in the comments, you can just wrapped the multiple commands you want to run within curly brackets like this: <?php if (function_exists (‘pluginName’)) { echo someName (7); echo someName (8); echo someName (9); } ?>