Conditional read more adjustment

It was simpler than I thought. This has solved it. <?php add_filter(‘the_content_more_link’, ‘modify_read_more_link’); function modify_read_more_link() { return ‘<a class=”more-link” href=”‘ . get_permalink() . ‘”>Your Read More Link Text</a>’; } the_content(“Read More”); ?>

Conditional tags or Multiple files

Before I start, and before you continue reading the rest of the post, make sure to check my answer regarding templates in WordPress index.php is not loaded for single posts Now that you understand that all templates, except index.php, are only nice-to-have templates, lets continue. ….notice that multiple files with little differences are preferred over … Read more

Check if the current shortcode is being used in a widget

There are two hooks, widget_text and dynamic_sidebar_params. You can use one of them. add_filter( ‘widget_text’, ‘wpse219770_filter_widget_text’, 1, 3 ); function wpse219770_filter_widget_text( $widget_text, $instance, $widget ) { $tag = ‘bartag’;//shortcode tag if ( ‘text-2’ == $widget->id && has_shortcode( $instance[‘text’], $tag ) ) remove_shortcode( $tag ); else add_shortcode( $tag, ‘bartag_func’ ); return $widget_text; } Or you can … Read more

Remove meta box for specific page

The is_page() conditional relies on the global $wp_query WP_Query object which isn’t set on the edit post page. We have some other options though… If we know the page ID we can test against $_GET: /** * Remove metaboxes * * @return void */ function wpse343020_remove_meta_boxes() { if( isset( $_GET, $_GET[‘post’] ) && 123 == … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)