How to get next day date of a specific day

Use the parameters of the shortcode with lowercase: [recurring_event short=”Wed” full=”wednesday”] Try to follow the next code: // NAV: Custom Code function wpcoder_recurring_event_att( $atts ){ $date=””; $default = array( ‘short’ => ‘Sun’, ‘full’ => ‘sunday’ ); $eventday = shortcode_atts($default, $atts); date_default_timezone_set(‘US/Eastern’); if(date(‘D’) == $eventday[“short”]) { echo date(‘F d, Y’); } else { // Create a … Read more

Parameter for pagination posts_pagination

To achieve the behavior you’re describing—keeping the “prev” or “next” buttons visible but not clickable when you’re on the first or last page—you can use a combination of CSS and conditionally modifying the pagination links. Here’s an example of how you can achieve this in WordPress: First, add the following CSS to your theme’s stylesheet … Read more

Add class to functions.php custom code to call font awesome icon

There’s no need to add another class. The code you’re using already creates separate classes and ID. You could do this with just css: Inspect your site with console, but your div label should be technical_documents so your code would be: #tab-title-technical_documents a::before { content: “\f02d”; font-family: ‘Font Awesome 6′; font-weight: 900; } You didn’t … Read more

Add custom text before all image captions in WordPress posts

You can filter the image caption using the wp_get_attachment_caption filter: add_filter( ‘wp_get_attachment_caption’, ‘wpse422651_filter_image_caption’, 10, 2 ); /** * Filters the image caption. * * @param string $caption The image caption. * @param int $attachment_id The attachment ID. * @return string The filtered caption. */ function wpse422651_filter_image_caption( $caption, $attachment_id ) { // Only run if the … Read more

Restricting page by user role

I’ll try to answer the question from beginning to end so for example, when user with customer role wants to login to example.com/about page, they will be redirected to another page. I want to do this in software, not with a plugin Note that you can turn the snippet into a plugin by adding this … Read more

Calling a PHP function from a menu item

There’s a few things to consider here. 1) You should always first check for a third-party plugin like WPML. If, for whatever reason, WPML stops working or gets deactivated, assuming it’s there could result in a fatal error. function directByLang() { if( defined( ‘ICL_SITEPRESS_VERSION’ ) ) { $current_lang = apply_filters(‘wpml_current_language’, NULL); if ($current_lang == ‘en’) … Read more

Cron Register everytime if i reload admin if i pass some extra argument in wp_schedule_event function

This happens because this code: if ( ! wp_next_scheduled( ‘myprefix_cron_hook’ ) ) { wp_schedule_event( time(), ‘every_one_hoursinwp’, ‘myprefix_cron_hook’,array(42)); } Is the same as this code: if ( ! wp_next_scheduled( ‘myprefix_cron_hook’, array() ) ) { wp_schedule_event( time(), ‘every_one_hoursinwp’, ‘myprefix_cron_hook’,array(42)); } And while you have lots of cron jobs with array(42), there is no next scheduled cron job … Read more

WordPress internal functions : why not use them?

Internal/private functions (their names are prefixed with an underscore) can be subject to changes without a warning and break backward compatibility unlike the public functions in general. This makes the core developement move faster being able to change part of the code without having to take deprecation steps over multiple versions of core. Many internal … Read more

File not found.