How to use post excerpt in WordPress Twenty Fifteen theme

In this tutoarial, I will show you, how you can fix the post excerpts issue in the WordPress Twenty Fifteen theme.
Twenty Fifteen theme has greatl layout, Neat & clean content area, great readability settings and other features Twenty Fifteen is going to be favorite of many bloggers. Most of the blog users expect post excerpts on front page. The Twenty Fifteen shows full article on front page, category page, search page etc . There are number of articles on front page, category page, archive pages, search page etc so the length of webpage becomes huge and webpage size also increases. This can be avoided by showing post excerpt in Twenty Fifteen.

For fixing excerpts issue, Look in the content.php which need to be modified for post excerpt.

/* translators: %s: Name of current post */
the_content( sprintf(
__( ‘Continue reading %s’, ‘twentyfifteen’ ),
the_title( ‘‘, ‘‘, false )
) );wp_link_pages( array(
‘before’ => ‘

‘,
‘link_before’ => ”,
‘link_after’ => ”,
‘pagelink’ => ‘‘ . __( ‘Page’, ‘twentyfifteen’ ) . ‘ %’,
‘separator’ => ‘, ‘,
) );
?>

You can see from the block of code shown above that full content of each post is displayed through the the_content() function. If we change this block of code to show full content for single post and post excerpt for all other cases, then purpose will be solved.

if ( is_single() ) :
Full post content

else :
Post excerpt

endif;

So for now we will have to modify our code. Look below I have modified the code

‘, ‘‘, false )
) );

wp_link_pages( array(
‘before’ => ‘

‘,
‘link_before’ => ‘‘,
‘link_after’ => ‘
‘,
‘pagelink’ => ‘‘ . __( ‘Page’, ‘twentyfifteen’ ) . ‘ %’,
‘separator’ => ‘, ‘,
) );
else :

/* translators: %s: Name of current post */
the_excerpt( sprintf(
__( ‘Continue reading %s’, ‘twentyfifteen’ ),
the_title( ‘‘, ‘‘, false )
) );

wp_link_pages( array(
‘before’ => ‘

‘,
‘link_before’ => ‘‘,
‘link_after’ => ‘
‘,
‘pagelink’ => ‘‘ . __( ‘Page’, ‘twentyfifteen’ ) . ‘ %’,
‘separator’ => ‘, ‘,
) );
endif;

?>

Now we have done!! This piece of code will work perfectly on the wordpress site.

WordPress blog excerpt not working in Themes

Some of the themes in wordpress does not display excerpt on blog page, category pages or archive pages. This is because theme does not include the experts code in the theme file.

This is a very simple tutorial that anyone can implement and take advantage of this built-in feature. The benefit of implementing this tutorial is that it decreases page load time and it increases the pageview count.

So we will have to update theme as per our need. For this process we will have to edit index.php file, archive.php file, and category.php file and find the code

<?php the_content(); ?>

If this is there then replace it with

<?php the_excerpt(); ?>

 

How to reset admin password in Magento 2

This is easy and complicated too!! There are two different methods to restore your admin password. The first one is quite easy while the second is more complicated..

In the first solution there is you need to reset password your email address stored in magento site.For this you need to open the admin panel of your store and click on the «Forgot your password?» link. Then, fill in your email address associated with the admin account and hit the «Retrieve Password» button.

In a moment, you’ll receive receive an email with the link that allows you to reset your current password or set a new one. Click on that and add your new password.

The second method is little complicated using phpMyadmin. First, you need to login to cPanel if you have one installed. Then, in the «Databases» section of the cPanel, select the phpMyAdmin link and copy the following sql query:
UPDATE admin_user SET password = CONCAT(SHA2('xxxxxxxYourNewPassword', 256), ':xxxxxxx:1') WHERE username = 'admin';

The xxxxxxx character sequence is a cryptographic salt.
it is saved in app\etc\env.php file


array (
'key' => '763701df77e6cba98d5e9a1bb3d935cv', //cryptographic salt
),
...

Invalid credentials for ‘https://repo.magento.com/packages.json’, aborting

If you get this error when trying to update via composer. So it means you are using wrong credentials.  For fixing this issue you must login into your magentocommerce account and create the Access Key

 

They you get public / private keys pair. Use those on those credentials and that will work.

 

Hope this will help.

How to enable star rating in Magento2

The star rating enable is easy process in magento2. Follow below steps :

Login into Admin Panel then go to

Stores -> Attributes -> Rating
Click on Price, Value, Quality Row and Checked Is Enable Checkbox from page and also set Visibility for your required store.

Save Rating and your ratings are display.

Clear cache and check in product details page.

magento2 CMS pages 404 error

Today I will show you, how you can fix the magento2 CMS pages 404 error. I got many times this issue while working on the magento 2 site. So finally I think, the fixes tricks may can help other person. This issue occurred due to single mode of the magento2 site.  Please follow below steps :

  1. Disable single store mode (admin>stores>configuration>general>general)
  2. Assign a store view to the CMS page.
    • go to your cms pages ( admin>content>pages)
    • edit the page which gives you the 404 message
    • Set the store view to “All Store Views”
    • save the page
  3. enable single store mode(admin>stores>configuration>general>general) (If you don’t want to site be single mode then leave this step)
  4. refresh cache (admin>system>cache management)

 

That’s all!!

 

Enable AJAX Submit in GravityForms in wordpress

If you want to use Ajax submit on GravityForms in wordpress then you must use the ajax=”true” in the shortcode otherwise the form will be not submitted as ajax and your page will be reloaded.

Below is the sample code for ajax submit
[gravityform id=”1″ title=”false” description=”false” ajax=”true”]

How to enable error reporting in Magento2

Here is the tip, how you can enable magento error reporting in magento 2

Connect FTP OR login into cpanel account and go to the following directory

pub/errors

find the local.xml.sample and rename to local.xml

and also on magento root folder find index.php and put the display error code at the bottom

error_reporting(E_ALL);
ini_set(‘display_errors’, 1);

Change woocommerce price position

If want to change the position of the price in wocommerce then this is possible. You can it easy in adding little code in the functions.php file.

If you want to put price near add to cart button then please add following code to Functions.php file of your child theme (or parent theme, if not using a child theme)- you can use Dashboard -> Appearance > Editor or direct FTP

remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 );
add_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 29 );

How to override .phtml files in Magento 2

Here is tips for how to override .phtml files in Magento 2. Please follow below steps

vendor/vendor/magento/module-checkout/view/frontend/templates/onepage.phtml

Follow this path

app/design/frontend/Vendor/theme/Magento_Checkout/templates/onepage.phtml