mdshak
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: I need help to solve Cumulative Layout Shift (CLS)After debugging your website, I found the errors related with google Ads. Are you using any plugin for inserting the google Ads. Please try to deactivate this particular plugin and other plugins, check your website. It may resolve the issue.
Forum: Fixing WordPress
In reply to: Customize function not working/changing header logoWhich theme is being used by you? It seems that you are using free version of theme and premium version of theme will allow to edit header logo.
Forum: Fixing WordPress
In reply to: looking for form pluginI would suggest to use the Contact form 7 plugin with these two add-ons.
https://www.ads-software.com/plugins/generate-pdf-using-contact-form-7/
https://www.ads-software.com/plugins/digital-signature-for-contact-form-7/
Forum: Developing with WordPress
In reply to: Block Binding API – Add prefix text with the binding valueI would suggest to use this code .
function custom_format_acf_value( $value, $post_id, $field ) { if ( $field['key'] === 'book_isbn' ) { if ( ! empty( $value ) ) { $value = sprintf( 'ISBN: %s', $value ); } } return $value; } add_filter( 'acf/format_value', 'custom_format_acf_value', 10, 3 );
The ‘ISBN: ‘ text will be prepended to the value of the ‘book_isbn’ field whenever it is displayed, but only if the field is not empty. This way, you can achieve the desired result without having to add an extra paragraph block.
Do you want to use any string like | or space to separate menu. I would request to share some screenshots and specific page URL to explain the issue exactly.
Forum: Developing with WordPress
In reply to: Loading a default pattern per custom post typeYou can load a specific custom pattern automatically when creating a post of a specific post type, you should use the
block_editor_settings
filter to set the initial pattern for the desired post type. Here’s how you can modify your code to get desire result.function load_post_type_patterns( $editor_settings, $post ) { // Define an initial pattern for the 'Book' post type if ( 'book' === $post->post_type ) { $editor_settings['__experimentalFeatures']['unfilteredTemplates']['book_template'] = array( array( 'title' => 'Custom Book Pattern', 'content' => array( array( 'core/block', array( 'ref' => 2603, // The ID of your custom pattern ), ), ), ), ); $editor_settings['template'] = 'book_template'; } return $editor_settings; } add_filter( 'block_editor_settings_all', 'load_post_type_patterns', 10, 2 );
This code adds a custom pattern named
book_template
for the ‘Book’ post type. When creating a new post of the ‘Book’ type, this pattern will be loaded automatically. Adjust the post type and pattern ID as needed for your setup.Forum: Everything else WordPress
In reply to: How to delete patterns in GutenbergIt is very easy to delete a pattern in WordPress.
Please refer this article for complete guidance.
https://wordpress.com/support/wordpress-editor/create-a-pattern/#delete-a-pattern
Forum: Fixing WordPress
In reply to: What RSS to email services are people using?Yes, MailChimp is little bit costly. You may choose one of them MailerLite, Sendinblue, Mailjet, Benchmark Email, FeedPress, Blogtrottr.
These are just a few examples, and the pricing and features may vary. It’s a good idea to compare the features and pricing of different services to find the best fit for your needs.
Forum: Networking WordPress
In reply to: Multisite for Subdomains + Single Installation for Main DomainPlease check in your In your WordPress multisite installation settings, ensure that the
WP_SITEURL
andWP_HOME
constants are set correctly for thewiki.example.com
site.
A). Log in to your WordPress dashboard for the multisite installation at sub.example.com.B). Go to “Network Admin” > “Sites” and make sure that there is a site configured for wiki.example.com. If not, create a new site with the appropriate subdomain.
C). Check the “Site Address (URL)” setting for the site configured for wiki.example.com. It should be set to https://wiki.example.com.
D). Ensure that the WordPress Address (URL) and Site Address (URL) settings under “Settings” > “General” are correctly configured for the multisite installation at sub.example.com.
Forum: Developing with WordPress
In reply to: handle Decimals with FocalPointPicker ?I would suggest to manipulate the values of focal point before
handleChangeobjectPosition
function like this way.<FocalPointPicker url={coverUrl ?? null} value={objectPosition} onChange={(focalPoint) => {
const newX = parseFloat(focalPoint
.x.toFixed(2)); const newY = parseFloat(focalPoint
.y.toFixed(2));handleChangeobjectPosition(newX,newY); }} resolvePoint={resolvepoint} />
Forum: Fixing WordPress
In reply to: Removing category base from URL adds category to my blog postsWhen you set your permalink structure to include the category base and then remove it using the dot (.) in the Category base field, WordPress should indeed remove the category base from your archive pages but not from your individual post URLs.
To remove the category base from individual post URLs as well, you can use the
post_link
andpost_type_link
filters to modify the permalink structure for posts. Please use this code at functions.php of your child theme.function remove_category_base_from_post_urls($permalink, $post) { if ($post && $post->post_type === 'post' && strpos($permalink, '/log/') !== false) { $permalink = str_replace('/log/', '/', $permalink); } return $permalink; } add_filter('post_link', 'remove_category_base_from_post_urls', 10, 2); add_filter('post_type_link', 'remove_category_base_from_post_urls', 10, 2);
This code checks if the permalink contains ‘/log/’ (your category base) and replaces it with ‘/’ for posts. This should remove the category base from your post URLs.
Make sure to flush the permalinks after adding this code by going to Settings > Permalinks and clicking on the “Save Changes” button to ensure that the changes take effect.
Thanks for bringing attention to this problem. May I have look into piece of code for
allowed_block_types_all
filter function. WordPress may not display the “Create pattern” button because it doesn’t detect any allowed block patterns. I will try to make some adjustment in code to avail the block pattern in certain conditions.Forum: Developing with WordPress
In reply to: Plugin for changing shipping class doesn’t workI would suggested to use this given below of code. It will work as you desire.
add_action('woocommerce_before_calculate_totals', 'set_shipping_class_for_first_product'); function set_shipping_class_for_first_product($cart) { // Check if the cart is empty if ($cart->is_empty()) return; // Initialize a flag to track if the shipping class has been set for the first shippable product $shipping_class_set = false; // Loop through each cart item foreach ($cart->get_cart() as $cart_item_key => $cart_item) { // Check if the product can be shipped (you may adjust this condition as per your requirement) if ($cart_item['data']->needs_shipping()) { // If the shipping class has not been set yet, set it for this product if (!$shipping_class_set) { $cart_item['data']->set_shipping_class_id(25); $shipping_class_set = true; // Set the flag to true to prevent setting the shipping class for subsequent shippable products break; // Exit the loop since we have set the shipping class for the first shippable product } } } }
Forum: Fixing WordPress
In reply to: Removing category base from URL adds category to my blog postsI checked through many URLs from your home page and I am not getting any issue as you explained. You have simple post title in your blog post URL slug like this https://followtheboat.com/our-most-dangerous-problem/.
Forum: Everything else WordPress
In reply to: How to copy post/page templates from one theme to another?WordPress templates are typically tied to the theme you’re currently using. When you switch themes, you may lose access to some templates because each theme has its own set of template files.
However, you can preserve your custom templates by either creating a child theme or using a plugin that allows you to export and import templates.