Showing posts with label Wordpress. Show all posts
Showing posts with label Wordpress. Show all posts

Sunday, 18 August 2019

Creating a Child Theme WordPress

Create two files
one with the name style.css and second with the name function.php
style.css
/**
* Theme Name:     theme name
* Author:         theme Team
* Template:       theme name
* Text Domain:       theme domain
* Description:    WordPress Theme Based on author name  Framework
*/
function.php
 <?php
add_action( 'wp_enqueue_scripts', 'Theme name _child_style' );
  function Theme name _child_style() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',get_stylesheet_directory_uri() . '/style.css',array('parent-style'));
}

To change the maximum file upload size

To change the maximum file upload size in PHP my admin
simply go make changes into the php.ini file
To increase media file upload size
  • go to Cpanel
  • site
  • wp-admin
  • see if there is any php.ini file
  • if so then edit it otherwise create a new file named as php.ini and write the following in it
post_max_size = 800M
 upload_max_filesize = 800M
 max_execution_time = 5000
 max_input_time = 5000
 memory_limit = 1000M
post_max_size =512M;
upload_max_filesize =512M;
  • save it
  • now enjoy uploading a file with size less than 512MB
If this technique does not work then try using htaccess Method
Some people have tried using the htaccess method where by modifying the .htaccess file in the root directory, you can increase the maximum upload size in WordPress. Open or create the .htaccess file in the root folder and add the following code:
php_value upload_max_filesize 64M
 php_value post_max_size 64M
 php_value max_execution_time 300
 php_value max_input_time 300

How to install wordpress on local host

Steps:
  • go to localhost/phpmyadmin
  • create a database with your desired name
  • exit
  • go to wordpress.org
  • download wordpress
  • extract the folder
  • edit the file with name wp_config-sample.php
  • go to (db_name,’database name’)
    enter your database name over here and save it
  • go to localhost/database name /wp-admin
  • select language
  • next
  • databasename = the name you choose
  • username = root
  • password = empty
  • database host = localhost
  • table prefix =wp_
  • submit
  • run the install
  • site title , username, password enter your desired information
  • email
  • congrats you have installed wordpress on localhost

Remove comments from a post in wordpress

  • go to xampp
  • htdocs
  • wordpress
  • wp-content
  • themes
  • select the specific theme
  • single.php
  • remove the comment code from there.

Remove catagories, archives, latest post, widgets from post in wordpress

  • go to xampp
  • htdocs
  • wordpress
  • wp-content
  • themes
  • select the specific theme
  • sidebar.php
  • remove the specific widget

To add custome style or js script in wordpress

To add custom style or js script in WordPress or you want to add any script in WordPress simply
  • go to editor
  • footer.php
  • paste the entire js script over there
    It will automatically be linked to js

Plugins for wordpress:

  • contact form 7
    best form plugin for contact us page
  • embedit pro
    one of the best plugin. It allows user to make shotcodes
  • To change header on different pages of wordpress
    use a plugin named wp-display header
  • To use page builder plugin
    install Black studio tiny mce widget
  • Page builder by site orgin
    install the best plugin ever with which you can make pages / post customixed and apply your favourite design or choose a page template. For that you may also install site origin widget bundle
  • woocommerce plugin
    best wordpress plugin for online shopping website
    after installing this plugin go to widget and select
    woocommerce price filter
    woocommerce top reated product
    woo commerce product catagory
  • To change add to cart button in woocommerce
    install change woocommerce add to cart button text plugin
    after installing go to setting
    reading
    scroll down
    you will see installed plugin

Adding Custom Fonts in WordPress Using CSS3 @font-face

First thing you need to do is download the font that you like
Once you have the font files, you would need to upload it on your web hosting server.
The best place to upload the fonts is inside a new “fonts” folder in your theme or child theme‘s directory.
You can use FTP or File Manager of your cPanel to upload the font.
Once you have uploaded the font, you need to load the font in your theme’s style sheet using CSS3 @font-face rule like this:
    @font-face {

        font-family: Arvo; 

        src: url(http://www.example.com/wp-content/themes/your-theme/fonts/Arvo-Regular.ttf); 

        font-weight: normal; 

    }
Don’t forget to replace the font-family and URL with your own.
After that you can use that font anywhere in your theme’s style sheet like this:
    .h1 site-title {

    font-family: "Arvo", Arial, sans-serif;

    }

Lost your WP password

If you have lost your password and want to retrieve it/ Change it  then
Go to Cpanel 
>Phpmyadmin
>Select the user whose password you want to change>Select the password and change the password type to MD5
>Then type the password you which to change 
>Your change will be made successfully 
>Now login WP and go to users
>change the password again from there 
>Enjoy

To add custome style or js script in wordpress

To add custome style or js script in wordpress or you want to add any script in wordpress simply
  • go to editor
  • footer.php
  • paste the entire js script over there
    It will automatically linked to js

Moving your WordPress from a subfolder to the root directory

Make a Backup of your account
Before performing the following procedure, it is a good idea to make a backup of your account prior to making any changes. Learn how to make a backup here: Backup website files in cPanel.
Prepare your WordPress installation for the move
Prior to physically moving the files, you will need to prepare the installation to accept the new URL name.
  1. Log into your WordPress Dashboard. For example.
  2. From the main dashboard, go to Administration -> Settings -> General
  3. Next, look for the WordPress address (URI): and change it from (example.com/WordPress to example.com)
  4. Lastly, look for the Site Address address (URL): and change it from (example.com/WordPress to example.com)
Moving your WordPress from a subfolder to your main folder
After you have made your backup, removed the site files from the builder, and prepared your WordPress files, it is time to move your WordPress to the primary folder.
  1. Log into your cPanel admin dashboard.
  2. From the main cPanel area, look for the Files category and then click on the File Manager tool. Go to Settings In the Preferences window that appears, select the checkbox entitled Show Hidden Files.
  3. Once inside the File Manager, you will want to navigate to the folder you have the WordPress site in. For example, a folder named WordPress.
  4. You will see a list of all the WordPress files and folders in the right-hand panel. Highlight them all and click on the Copy icon from the menu toolbar across the top of the page.
  5. A popup will appear so you can enter the destination folder. Continuing with our WordPress folder example, it should show as public_html/WordPress. Remove the /WordPress from the destination path so that it simply displays as public_html. Click the Copy Files button.
  6. This will copy the files up to the public_html folder. Use the File Manager to navigate back to the public_html folder. (You can do this by clicking on the Up One Level button from the toolbar across the top of the right-hand panel.)
  7. You should now see the same files as you have in your WordPress folder.
  8. You can now delete the old WordPress folder.
Log in and finish the URL details
  1. Log into your NEW WordPress admin dashboard. For example (example.com/wp-admin or example.com/wp-login.php)
  2. Go to Administration -> Settings -> Permalinks and ensure the link structure is the same as your new URL.

WordPress Image Thumbnail crop issue fix

When we add a post on wordpess it crop’s the image on the front view which is looking bad. So to fix this issue
Go to -> include > media.php

comment the line of codes starting from 

if($crop){

//crop the largest .............. 

so basically comment the crop the largest portion
and your issue will be fixed.

Adding Anchor to a menu in a website

This code is for HTML
 <li> <a href="#A1">Jump </a></li>  <div id="A1"> </div>

This code is for WordPress
Go to Dashboard -> appearance -> menus -> custom links -> #A1 (This will be the URL)

Now go to the page where you want this to work 

<h1 id="A1"> Jump here </h1>

To add Scrolling effect to the anchor 
$function(){
$(''a[href *=# ]: not ([href =#])').click(function(){
if(location.pathname.replace(/^\ //,' ') == this.pathname.replace(/^\ //,'') && location.hostname == this.hostname){
Var target = $(this.hash);
target=target.length ? target:$('[name='+this.hash.slice(1)+']');

if (target.length){
$('html,body').animate({
scrollTop: target.offset().top
},1000);

return false;
}
}
});
});