S P Pramodh
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Media API is showing errorHello @alankar1985,
The error message
"rest_forbidden"
with status401
indicates that the WordPress REST API is blocking access to certain media items due to permission issues. Here are some of tips that may helpGo to the Media Library in the WordPress dashboard, check the visibility of the affected media items, and ensure they aren’t set to private or restricted.
Verify that the current user role has the necessary capabilities to view the media items. Since you’re using administrator credentials, this shouldn’t usually be a problem, but some custom code or plugins could modify default capabilities.
Forum: Plugins
In reply to: [WooCommerce] Add class to related-products componentHello @vds1dgtl,
You can use a WooCommerce hookwoocommerce_output_related_products_args
to add the class programmatically: This function uses WooCommerce’s hook to wrap the related products section with a custom class without having to modify therelated.php
template.add_filter( 'woocommerce_output_related_products_args', 'custom_related_products_class' );
function custom_related_products_class( $args ) {
$args['before'] = '<div class="related-products-container custom-class">';
$args['after'] = '</div>';
return $args;
}Let me know how it goes or if you need further assistance!
Forum: Fixing WordPress
In reply to: Picture shows blurredYou’re very welcome! I’m glad to hear you gave it a try. No worries at all—I’m happy to assist, and it’s always great to support non-profit work. Wishing you all the best with your project!
Forum: Fixing WordPress
In reply to: Picture shows blurredHello Paul,
If the image is of good quality but appears blurry because it is being stretched to fit a larger area, then adjusting its display size should solve the issue. The image’s width and height are being forced to fit a specific size. You can adjust the CSS to ensure that the image maintains its aspect ratio without being stretched.
Let me know if this resolves the issue or if you need any help!
Forum: Installing WordPress
In reply to: Is it possible to add WordPress Blog to a Joomla Website?Hello Mario,
Running WordPress alongside Joomla is a feasible solution, and with the right setup, you can keep Joomla as your main CMS while using WordPress for its blogging capabilities. Here’s my suggestions:
Sub directory Approach: You can install WordPress in a sub directory of your Joomla site, for example,
yourjoomlasite.com/blog/
. This allows you to keep Joomla as the primary CMS for the site while having WordPress handle the blog in the sub directory.Subdomain Approach: Alternatively, you could install WordPress on a subdomain like
blog.yourjoomlasite.com
. This method keeps the two CMS platforms even more separate, but with proper design integration, users won’t notice the difference.If you want to sync data between Joomla and WordPress, there are a few plugins/extensions for help. If plugins don’t meet your needs, you might need a custom solution. A developer could help create a synchronization system where data are shared between Joomla and WordPress.
I hope this helps.
Forum: Developing with WordPress
In reply to: Adding a variable to some PHP code with gettextHello @sacconi,
No worries! I’ll guide you through to identify the issue.
It seems that the issue might stem from how you’re trying to retrieve the
current_year
value usingget_the_author_meta()
. By default, WordPress doesn’t store a meta field calledcurrent_year
for users. Unless you have explicitly added this custom meta field (e.g., through a plugin or custom code), the value will likely be empty, which is why the output shows:Rates in €/ week:
If you’re simply trying to display the current year dynamically, you can use PHP’s built-in function
date('Y')
instead of relying onget_the_author_meta()
If this works then it confirms the issue is with the meta field. Here’s the updated code:
$current_year = date('Y'); // This will get the current year, e.g., 2024
$titolo_display_price = sprintf(
'<div class="titolo_listino_prezzi" ID="titolo_listino_prezzi">' .
'<h3 class="titolo_affitti">' . esc_html__( 'Rates %s in €/ week:', 'mysite-plugin' ) . '</h3>' .
'</div>',
esc_html( $current_year )
);Let me know if you need further assistance.
Forum: Developing with WordPress
In reply to: Adding a variable to some PHP code with gettextHello @sacconi,
To incorporate the
$current_year
variable into your existing PHP code withgettext
, you’ll need to update the string dynamically while ensuring that the translation function still works properly.Here’s simple solution to achieve this:
$titolo_display_price = sprintf(
'<div class="titolo_listino_prezzi" ID="titolo_listino_prezzi">' .
'<h3 class="titolo_affitti">' . esc_html__( 'Rates %s in €/ week:', 'mysite-plugin' ) . '</h3>' .
'</div>',
esc_html( $current_year )
);WordPress provides
wp_kses()
for safely including variables in translatable strings, and it can also handle HTML within strings more effectively, without requiring too much concatenation. Try this out
Let me know if this solution worked for your!Hello ColinD,
You’re absolutely correct—when the Query Loop Block is set to inherit its query from the template, the
query_loop_block_query_vars
filter does not run. This is because, in inherit mode, the block uses the main query ($wp_query
) that’s already been established by WordPress, rather than creating a new custom query. As a result, the filter designed to modify the Query Loop Block’s custom queries isn’t applied.
Thepre_get_posts
hook allows you to modify the main query parameters before it’s executed, which will, in turn, affect any blocks or templates relying on that query—including the Query Loop Block set to inherit. It is the recommended and widely accepted method for modifying queries before they are executed.Ensure you include the necessary conditional checks (
! is_admin()
,$query->is_main_query()
,is_archive()
,is_category()
,is_post_type_archive()
etc.) to target only the queries you want to modify. This prevents unintended effects on other queries.I hope this clarifies your doubt and helps you make an informed decision. If you have further questions or need assistance feel free to ask!
Forum: Everything else WordPress
In reply to: Should I redirect Category link to page?Hello @catuyen,
That’s a great question and quite relevant in terms of SEO and user experience. Here’s my opinion to help you decide:
For optimal SEO and user experience, it is advisable to redirect/category/city1/real-estate/
to/city1-real-estate/
.
Reasons:- A 301 permanent redirect passes the majority of SEO equity from the old URL to the new one. Prevents internal competition for rankings between similar pages.
- Ensures search engines index only one version of the content. Reduces the risk of content cannibalization, where multiple pages compete for the same keyword.
I hope this helps you make an informed decision!
Hello @notabeginnerbutnotanexperteither,
Congratulations on taking on this exciting project! It sounds like you’re ready to rebuild the company’s website on WordPress while keeping the existing domain and preserving SEO, so let’s walk through the process step by step.
1. Domain Transfer vs. DNS Update- DNS Update: Instead of transferring the domain, you can leave it with the current registrar and update the DNS settings to point to your new hosting provider when the site is ready. This involves changing the nameservers or A records (provided by your new host). This method is often simpler and faster, especially when keeping the domain at its original registrar.
- Authorization Code (EPP Code): If you do decide to transfer the domain to a new registrar, you’ll need to request an EPP code from the current registrar to complete the transfer. However, as mentioned, this isn’t always necessary if you’re comfortable just updating the DNS.
2. Building the New Website
You can start building the new WordPress site without affecting the current one by using
- Staging Site or Temporary Domain: Many hosting providers offer staging environments, or you can use a subdomain (e.g., new.example.com) to build the new site. This allows the current site to stay live while you work on the new one.
- Local Development Environment: Tools like @wordpress/env, XAMPP or MAMP let you build the new site on your local machine, which you can later migrate to the live server. This approach means the new site can be fully built and tested before making any changes to the live site..
3. SEO Considerations
- Maintain URL Structures: To preserve SEO rankings, it’s important to keep the same URL structure (permalinks) wherever possible. This helps search engines recognize the new site without dropping rankings or leading to broken links.
- 301 Redirects: If any URLs need to change, it’s essential to set up 301 redirects from the old URLs to the new ones. This tells search engines that the content has permanently moved, preserving any SEO value.
- How to Set Up Redirects: There are plugins that make managing redirects simple and user-friendly.
I hope this helps get you started! Feel free to ask if you have more questions or need further clarification. Good luck with the migration!
Forum: Everything else WordPress
In reply to: how to achieve this (photo attached ) via Gutenberg ?Hi @xue2024jian,
It looks like the title mentions a photo, but I can’t see it attached. There might not be an option to upload files directly to the support ticket, but you can share a link to your screenshot or image hosted on Dropbox, Google Drive, or any other file-sharing service. You can include that link in the “Link to the page you need help with:” text box.
Alternatively, you can add an image block by clicking the “+” icon and inserting it directly into your message. This will help us better understand your question and provide a more accurate solution. Thanks!