Sourav Pan
Forum Replies Created
-
Forum: Plugins
In reply to: [LiteSpeed Cache] in pagespeed getting 41 score after install litespeedThis problem occurs due to this reason;
first i installed ezoic plugin to integrate my site with ezoic.
Then i deactivated litespeed cach plugin
after that, i again uninstalled ezoic, and removed my site from ezoic server.
then again i installed litespeed plugin, and then this problem is showing, How to solve this?
(My website was not fully integrated with ezoic, before that i remove my site from ezoic)
Forum: Plugins
In reply to: [LiteSpeed Cache] in pagespeed getting 41 score after install litespeedTo create an Amazon product carousel within your single post template using the GeneratePress theme, you’ll need to use the Amazon Product Advertising API to retrieve product information and display it in a carousel format. Here’s an overview of the steps you’ll need to take:
- Register for the Amazon Product Advertising API: You’ll need to create an Amazon Associates account and register for the API to get your access key and secret key.
- Retrieve product information: Use the API to retrieve information about the products you want to display in the carousel. You’ll need to make an API call and parse the JSON response to get the information you need, such as product images, prices, and links.
- Create the carousel HTML: Use the information you retrieved from the API to create the HTML for the carousel. You can use a JavaScript library like Slick or Owl Carousel to create the carousel and add the product information to the HTML.
- Add the carousel to your single post template: Add the HTML for the carousel to your single post template, typically single.php or content-single.php. Make sure to enqueue the required scripts and styles in your theme’s functions.php file.
- Customize the design: Customize the design of the carousel to match the look and feel of your website. You can use CSS to adjust the size, colors, and layout of the carousel.
Here’s an example of how you might use the Amazon Product Advertising API and the Slick library to create a carousel of products within your single post template: I’ll provide you with a general idea of how it can be implemented.
<div class="product-carousel"> <?php //retrieve product information using the API $access_key = "YOUR_ACCESS_KEY"; $secret_key = "YOUR_SECRET_KEY"; $associate_tag = "YOUR_ASSOCIATE_TAG"; $request_url = "https://webservices.amazon.com/onca/xml?Service=AWSECommerceService&Operation=ItemSearch&SearchIndex=All&Keywords=book&AssociateTag=" . $associate_tag . "&AWSAccessKeyId=" . $access_key . "&Timestamp=" . gmdate("Y-m-d\TH:i:s\Z") . "&Signature=" . urlencode(base64_encode(hash_hmac("sha256", "GET\nwebservices.amazon.com\n/onca/xml\nService=AWSECommerceService&Operation=ItemSearch&SearchIndex=All&Keywords=book&AssociateTag=" . $associate_tag . "&AWSAccessKeyId=" . $access
The above code snippet is incomplete and it’s just an example of how to use the Amazon Product Advertising API to retrieve product information. There are several other steps that need to be performed like parsing the JSON response, generating the carousel HTML, enqueueing the scripts and styles and customizing the design to fit your theme.
Also, it’s important to note that Amazon has strict rules and regulations regarding the use of their API and affiliate program. You’ll need to read and follow the guidelines provided by Amazon to ensure that your use of the API and affiliate program complies with their policies.
I would recommend consulting with a developer who has experience working with the Amazon Product Advertising API and the GeneratePress theme, or using a plugin that supports the Amazon Product Advertising API and can generate a carousel for you.
Forum: Themes and Templates
In reply to: [GeneratePress] Link QueryYou can use the wp_targeted_link_rel() filter to change the link rel attribute for outbound links in GeneratePress. Here’s an example of how you can use this filter to set the link rel attribute to “noopener only” for outbound links:
function custom_link_rel( $rel, $link ) { if ( strpos( $link, '//' ) === 0 && strpos( $link, home_url() ) === false ) { $rel = 'noopener'; } return $rel; } add_filter( 'wp_targeted_link_rel', 'custom_link_rel', 10, 2 );
You can add this code to your theme’s
functions.php
file, or you can use a plugin like Code Snippets to add it.The function first checks if the link is an outbound link using the
strpos()
function, which checks if the link starts with “//” and doesn’t contain the home URL. If the link is an outbound link, the function changes the link rel attribute to “noopener”.It’s important to note that this filter only affects links that are added to the post content, not the links that are added to the post meta or other places in the theme.
Also, “noopener” attribute is added to the link to prevent a newly opened tab from having access to the window.opener object, which can be used
Forum: Plugins
In reply to: [LiteSpeed Cache] I want to exclude this js codethis code is showing when admin is login but not showing when goining to incognite mode
Here is the full code
* @param string $string String to convert.
*/
public static function mb_ucwords( $string ) {
if ( ! function_exists( ‘mb_convert_case’ ) || ! function_exists( ‘mb_detect_encoding’ ) || mb_detect_encoding( $string ) !== ‘UTF-8’ ) {
return ucwords( $string );
}$words = preg_split( ‘/([\s]+)/u’, $string, -1, PREG_SPLIT_DELIM_CAPTURE );
$ucwords = ”;
foreach ( $words as $word ) {
$ucwords .= preg_match( ‘/[\p{L}]/u’, $word[0] ) ? mb_strtoupper( $word[0], ‘UTF-8’ ) . mb_substr( $word, 1, mb_strlen( $word ), ‘UTF-8’ ) : $word;
}return $ucwords;
}
}and here is the 235 lin
$ucwords .= preg_match( ‘/[\p{L}]/u’, $word[0] ) ? mb_strtoupper( $word[0], ‘UTF-8’ ) . mb_substr( $word, 1, mb_strlen( $word ), ‘UTF-8’ ) : $word;
Forum: Themes and Templates
In reply to: [GeneratePress] Showing this error when updated to php 8.1Here is the code
function wp_add_inline_style( $handle, $data ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); if ( false !== stripos( $data, '</style>' ) ) { _doing_it_wrong( __FUNCTION__, sprintf( /* translators: 1: <style>, 2: wp_add_inline_style() */ __( 'Do not pass %1$s tags to %2$s.' ), '<code><style></code>', '<code>wp_add_inline_style()</code>' ), '3.7.0' ); $data = trim( preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) ); } return wp_styles()->add_inline_style( $handle, $data ); }
The bolded line is 90 number code, which is showing in error msg
Forum: Plugins
In reply to: [WP ULike - All-in-One Engagement Toolkit] Custome loop of top liked postI want this to implement within my index.php file manually, without any short code.
Here is an example of custome post loop, i want to show top liked post using this loop, how i can do this?`<?php
$loop = new WP_Query( array( ‘post_type’ => ‘property’, ‘category_name’ => ‘current’, ‘ignore_sticky_posts’ => 1, ‘paged’ => $paged ) );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class=”pindex”>
<?php if ( has_post_thumbnail() ) { ?>
<div class=”pimage”>
<a href=”<?php the_permalink(); ?>”><?php the_post_thumbnail(); ?></a>
</div>
<?php } ?>
<div class=”ptitle”>
<h2><?php echo get_the_title(); ?></h2>
</div>
</div>
<?php endwhile;
if ( $loop->max_num_pages > 1 ) : ?>
<div id=”nav-below” class=”navigation”>
<div class=”nav-previous”><?php next_posts_link( __( ‘<span class=”meta-nav”>←</span> Previous’, ‘domain’ ) ); ?></div>
<div class=”nav-next”><?php previous_posts_link( __( ‘Next <span class=”meta-nav”>→</span>’, ‘domain’ ) ); ?></div>
</div>
<?php endif;
endif;
wp_reset_postdata();
?>`- This reply was modified 2 years, 6 months ago by Sourav Pan.
- This reply was modified 2 years, 6 months ago by Sourav Pan.
Forum: Plugins
In reply to: [Web Stories] How to add web stories within Template file@swissspidy
ok, thanksForum: Plugins
In reply to: [Web Stories] How to add web stories within Template fileOk, here is my url
https://microbiologynote.com/Forum: Plugins
In reply to: [Web Stories] How to add web stories within Template fileNo, actually I want to insert webstories in my home page, for that i have to edit the index.php file, i can’t find the Gutenberg block in customization section of the theme.
I want to add webstories curosle at this highlighted location:
https://prnt.sc/1gftgeoSee the example of webstories:
https://prnt.sc/1gfuf2sForum: Plugins
In reply to: [Yoast SEO] How to fix Invalid URL in field “id”ok
Forum: Plugins
In reply to: [Yoast SEO] How to fix Invalid URL in field “id”Yes, you are right, i checked it again there is no error. Can i uninstall the ”
Yoast Test Helper” plugin from my wordpress?….or it shouldbe installed?Forum: Plugins
In reply to: [Yoast SEO] How to fix Invalid URL in field “id”@suascat_wp
I followed your instruction but still, it’s not working. showing the same error
https://prnt.sc/1cxd4seForum: Plugins
In reply to: [Yoast SEO] How to fix Invalid URL in field “id”Hey, I have tried everything you asked me to do;
first of all disabled all the plugins all I have and then i run the URL in Structured Data Testing Tool, the result is fine there is no error. Then i enable one by one plugin and also i checked the URL every time on the Structured Data Testing Tool, find out no error, but when i turn on the yoast plugin the error appears again.I also changed my theme to twenty twenty and disabled all the plugin except yoast, the error was still there, it seems to me the error is creating by Yoast. I have tried everything to catch the error, i think no plugins/themes are conflicting with the yoast plugin, can you please check this error again. and today i checked 63 pages are now affected by this error, day by day the number of error pages are increasing.