how to remove colon and white space in a string by php
Check This Code: $demo_string = “The Godfather: Part II”; $demo_string = str_replace(‘:’, ”, $demo_string); $demo_string = str_replace(‘ ‘, ”, $demo_string); output : TheGodfatherPartII
Check This Code: $demo_string = “The Godfather: Part II”; $demo_string = str_replace(‘:’, ”, $demo_string); $demo_string = str_replace(‘ ‘, ”, $demo_string); output : TheGodfatherPartII
The CSS is generated on the file inc/custom-css.php, the background color is set on line 76: $background = sanitize_hex_color_no_hash( get_theme_mod( ‘background_color’ ) ); So you can take advantage of the theme_mod_{$name} filter, which changes the value of the get_theme_mod($name) function, by adding this to your functions.php file: add_filter( ‘theme_mod_background_color’, function( $value ) { $custom_bg_page_ids = … Read more
I agreed with @PatJ — you should check if get_queried_object() returns an object or not. But you could simplify your code by simply using is_category() and in_category() which are conditional tags in WordPress: if ( is_category( 3 ) || in_category( ‘arta’ ) ) { wp_enqueue_style( ‘twentytwenty-style-2’, get_stylesheet_directory_uri() . ‘/style-arta.css’, array(), $theme_version ); }
When you include wp-load.php, WordPress will load wp-config.php, where constants with the same identifiers you have chosen here are already defined. This should be throwing warnings regarding the duplicate definition. Because you cannot re-define constants, the values you are attempting to set in this file are ignored. Choose different names for them if they are … Read more
Your full form code does contain a hidden input named action with the value send_form. However, you’re not sending it correctly, because of the the contentType part in your JS script, which submits the form data as a JSON payload, but note that the old admin-ajax.php endpoint doesn’t support JSON payload, hence $_REQUEST[‘action’] would be … Read more
This is called php annotations. Many of them are built-in via a standard called phpdoc (like @var), and they are used by the interpreter or the static tools (also by humans for a more structured comment). There is another usecase for these annotations, and it’s to run some code – probably using reflections (which usually … Read more
But there is no content directory in template directory. Actually, with the following: get_template_part( ‘templates/content’, ‘header-private’ ); get_template_part( ‘templates/content’, ‘header-public’ ); WordPress will search in the templates folder for content-header-private.php or content-header-public.php, and if found, it is loaded. Else, WordPress will attempt to load the content.php file instead. So WordPress (or get_template_part()) will not search … Read more
From your code the proper structure would be if ( is_singular() ) { if (get_post_meta(get_the_ID(), ‘square_image’, true)) { echo ‘<img src=”‘ . get_post_meta($post->ID, ‘square_image’, true) . ‘”/>’; } else { the_post_thumbnail( ‘thumbnail’ ); } } We can make it a bit better by creating a variable that will contain the meta data so we don’t … Read more
I noticed your apwb_settings_page() function is adding the “Postal Pricing Settings” submenu using add_options_page(), and the documentation stated that: (bold formatting added by me) This function is a simple wrapper for a call to add_submenu_page(), passing the received arguments and specifying ‘options-general.php‘ as the $parent_slug argument. This means the new options page will be added … Read more
Okay, first off, that’s an incredibly badly made theme. Your item number 2 there indicates to me that he making AJAX calls in entirely the wrong way. Secondly, look for anything in the theme that is using http but not in a link. allow_url_include basically lets you include some PHP from a remote site, which … Read more