Category: Wordpress

How to create child theme in WordPress Step by Step without WordPress plugin

Way To create child theme in WordPress Step by Step

How to create child theme in WordPress Step by Step without wordpress plugin

Steps to create child theme in wordpress without WordPress plugin

After logging into FTP dashboard ,drag all wordpress twenty seventeen child theme downloaded Files inside /public_html

Download wordpress twenty seventeen child theme latest version of WordPress

Now locate the functions.php file

The location to the file may look like : /home/username/public_html/wp-content/themes/twentyseventeenchild/functions.php

Make a local backup of this file in case anything goes wrong and you may need to revert to previous stable code.

click on it to begin editing it.

Put this below code in your functions.php if its not there or remove exisitng code & paste below code

<?php
add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
function my_theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
}
?>

Now locate the style.css file

Put this below code in your style.css if its not there or remove existing code & paste below code

 

/*
Theme Name: Twenty Seventeen Child
Theme URI: https://share-ask.com
Description: Twenty Seventeen Child
Author: WebsiteBundles
Author URI: https://share-ask.com
Template: twentyseventeen
Version: 1.0.0
Text Domain: Twenty-Seventeen-child
————————————————————– */

/* =Theme customization starts here
——————————————————- */

 

Steps to create child theme in wordpress with WordPress plugin

. Then After logging into WordPress dashboard go to plugin section  at the left hand side and Upload plugin One-Click Child Theme. and activate the plugin.

In WordPress dashboard go to Appearance > child theme from the menu at the left hand side as shown in below pics give it a name ,description click create child button .

one-click child theme tutorial

That’s it! you have created child theme in wordpress with WordPress plugin

How to create a child theme in WordPress video

This will create child theme in WordPress Step by Step without wordpress plugin

Let me know besumitbe@gmail.com/skype-bpshbp if you have any Query

 

 

 

How To Reinstall WordPress Core Files without losing content in dashboard

Quick way to How To Reinstall WordPress Core Files  without losing content

After logging into WordPress dashboard go to updates > Re-install Now from the menu at the left hand side as shown below.How To Reinstall WordPress Core Files without losing content dashboard

Then WordPress will automatically Reinstall WordPress Core Files  without losing content in dashboard.

Let me know besumitbe@gmail.com/skype-bpshbp if you have any Query

 

How To Reinstall WordPress Core Files without losing content via FTP

Way to How To Reinstall WordPress Core Files without losing content via FTP

  1. After logging into FTP dashboard ,drag all WordPress Core Files inside /public_html
  2. Download the latest version of WordPress
  3. Download ENTIRE WordPress files of your site
  4.  
  5. Open your Downloaded WordPress files of your site  say /quarantine is your entire site folder.

Open wp-config.php  and copy information as shown below

 

6.Navigate to your public_html directory and you should see a file called wp-config-sample.php, right-click on this file and Edit, open the file in Notepad then fill in your database name, database user, and database user password and save it as shown below.

 

7.Now  right-click on wp-config-sample.php choose Rename, and then name the file just wp-config.php as shown below. .

 

8.Now upload your  theme from here /quarantine/wp-content/themes to /public_html/wp-content/themes directory as shown below. .

ftp upload backup theme wordpress

 

This will complete Reinstall WordPress Core Files without losing content via FTP

Insert ads after second paragraph of single post content without wordpress plugin

How to insert ads within your post content after second paragraph in wordpress without wordpress plugin

After logging into WordPress dashboard go to Appearance > Editor from the menu at the left hand side.

Now locate the functions.php file

The location to the file may look like : /home/username/public_html/wp-content/themes/currently_active_theme/functions.php

Make a local backup of this file in case anything goes wrong and you may need to revert to previous stable code.

click on it to begin editing it.

Put this below code in your functions.php to to Insert ads after second paragraph of single post content without wordpress plugin

add_filter( ‘the_content’, ‘prefix_insert_post_ads’ );

function prefix_insert_post_ads( $content ) {

$ad_code = ‘<div>YOUR AD CODE</div>’;

if ( is_singular() && ! is_admin() ) {
return prefix_insert_after_paragraph( $ad_code, 2, $content );
}

return $content;
}

function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
$closing_p = ‘</p>’;
$paragraphs = explode( $closing_p, $content );
foreach ($paragraphs as $index => $paragraph) {

if ( trim( $paragraph ) ) {
$paragraphs[$index] .= $closing_p;
}

if ( $paragraph_id == $index + 1 ) {
$paragraphs[$index] .= $insertion;
}
}

return implode( ”, $paragraphs );
}

 

Note replace above YOUR AD CODE with your adsense code

This will Insert ads after second paragraph of single post content without wordpress plugin

Let me know besumitbe@gmail.com/skype-bpshbp if you have any Query

 

WordPress Dynamic XML Sitemap Without Plugin

WordPress Dynamic XML Sitemap Without Plugin

After logging into WordPress dashboard go to Appearance > Editor from the menu at the left hand side.

Now locate the functions.php file

The location to the file may look like : /home/username/public_html/wp-content/themes/currently_active_theme/functions.php

Make a local backup of this file in case anything goes wrong and you may need to revert to previous stable code.

click on it to begin editing it.

Put this below code in your functions.php to to Add WordPress XML Sitemap Without Plugin

 

add_action(“publish_post”, “eg_create_sitemap”);
add_action(“publish_page”, “eg_create_sitemap”);
function eg_create_sitemap() {
$postsForSitemap = get_posts(array(
‘numberposts’ => -1,
‘orderby’ => ‘modified’,
‘post_type’ => array(‘post’,’page’),
‘order’ => ‘DESC’
));
$sitemap = ‘<?xml version=”1.0″ encoding=”UTF-8″?>’;
$sitemap .= ‘<?xml-stylesheet type=”text/xsl” href=”sitemap-style.xsl”?>’;
$sitemap .= ‘<urlset xmlns=”https://www.sitemaps.org/schemas/sitemap/0.9″>’;
foreach($postsForSitemap as $post) {
setup_postdata($post);
$postdate = explode(” “, $post->post_modified);
$sitemap .= ‘<url>’.
‘<loc>’. get_permalink($post->ID) .'</loc>’.
‘<priority>1</priority>’.
‘<lastmod>’. $postdate[0] .'</lastmod>’.
‘<changefreq>daily</changefreq>’.
‘</url>’;
}
$sitemap .= ‘</urlset>’;
$fp = fopen(ABSPATH . “sitemap.xml”, ‘w’);
fwrite($fp, $sitemap);
fclose($fp);
}

 

Next copy existing template  as  /home/username/public_html/wp-content/themes/currently_active_theme/

so for us our path is /SHAREASKCOM_1/wp-content/themes/share-askchild

Next name copied file as sitemap here  /home/username/public_html/wp-content/themes/currently_active_theme/sitemap

so for us our path is /SHAREASKCOM_1/wp-content/themes/share-askchild/sitemap

Now find </header> in the new file sitemap and paste below code after </header>

 
<div class=”html-sitemap”>

<h2>Pages:</h2>
<ul class=”sitemap-pages”>
<?php
//https://codex.wordpress.org/Function_Reference/wp_list_pages
wp_list_pages(‘exclude=889&title_li=’); //***Exclude page Id, separated by comma. I excluded the sitemap of this blog (page_ID=889).
?>
</ul>

<h2>Posts:</h2>
<ul>
<?php
//https://codex.wordpress.org/Function_Reference/get_categories
$cats = get_categories(‘exclude=’); //***Exclude categories by ID, separated by comma if you like.

foreach ($cats as $cat) {
echo ‘<li class=”category”>’.”\n”.'<h3><span class=”grey”>Category: </span>’.$cat->cat_name.'</h3>’.”\n”;
echo ‘<ul class=”cat-posts”>’.”\n”;

//https://codex.wordpress.org/Function_Reference/query_posts
query_posts(‘posts_per_page=-1&cat=’.$cat->cat_ID); //-1 shows all posts per category. 1 to show most recent post.

//https://us3.php.net/while ; https://codex.wordpress.org/The_Loop ; https://codex.wordpress.org/The_Loop_in_Action
//https://codex.wordpress.org/Function_Reference/the_time ; https://codex.wordpress.org/Function_Reference/the_permalink
//https://codex.wordpress.org/Function_Reference/the_title ; https://codex.wordpress.org/Function_Reference/comments_number
while(have_posts()): the_post();
//https://codex.wordpress.org/Function_Reference/get_the_category
$category = get_the_category();
//Display a post once, even if it is in multiple categories/subcategories. Lists the post in the first Category displayed.
if ($category[0]->cat_ID == $cat->cat_ID) {?>
<li><?php the_time(‘M d, Y’)?> &raquo; <a href=”<?php the_permalink() ?>” title=”Permanent Link to: <?php the_title(); ?>”>
<?php the_title(); ?></a> (<?php comments_number(‘0’, ‘1’, ‘%’); ?>)</li>
<?php } //endif
endwhile; //endwhile
?>
</ul>
</li>
<?php } ?>
</ul>
<?php
//https://codex.wordpress.org/Function_Reference/wp_reset_query
wp_reset_query();
?>
<h2>Archives:</h2>
<ul class=”sitemap-archives”>
<?php
//https://codex.wordpress.org/Function_Reference/wp_get_archives
wp_get_archives(‘type=monthly&show_post_count=true’);
?>
</ul>
</div>

 

This will give us WordPress XML Sitemap Without Plugin

Let me know besumitbe@gmail.com/skype-bpshbp if you have any Query

Remove query strings from static resources without wordpress plugin

Way toRemove query strings from static resources without wordpress plugin

After logging into WordPress dashboard go to Appearance > Editor from the menu at the left hand side.

Now locate the functions.php file

The location to the file may look like : /home/username/public_html/wp-content/themes/currently_active_theme/functions.php

Make a local backup of this file in case anything goes wrong and you may need to revert to previous stable code.

click on it to begin editing it.

Put this below code in your functions.php to to Remove query strings from static resources without wordpress plugin

 

function _remove_script_version( $src ){
$parts = explode( ‘?ver’, $src );
return $parts[0];
}
add_filter( ‘script_loader_src’, ‘_remove_script_version’, 15, 1 );
add_filter( ‘style_loader_src’, ‘_remove_script_version’, 15, 1 );

This will Remove query strings from static resources without wordpress plugin

Let me know besumitbe@gmail.com/skype-bpshbp if you have any Query

Add Defer and Async Attributes to Render Blocking Javascript in wordpress without plugin

How to Add Defer and Async Attributes to Render Blocking Javascript

After logging into WordPress dashboard go to Appearance > Editor from the menu at the left hand side.

Now locate the functions.php file

The location to the file may look like : /home/username/public_html/wp-content/themes/currently_active_theme/functions.php

Make a local backup of this file in case anything goes wrong and you may need to revert to previous stable code.

click on it to begin editing it.

Put this below code in your functions.php to to Add Defer and Async Attributes to Render Blocking Javascript

function js_async_attr($tag){

# Add async to all remaining scripts
return str_replace( ‘ src’, ‘ defer=”defer” src’, $tag );
}
add_filter( ‘script_loader_tag’, ‘js_async_attr’, 10 );

This will Add Defer and Async Attributes to Render Blocking Javascript in wordpress without plugin

Let me know besumitbe@gmail.com/skype-bpshbp if you have any Query

How to Remove the […] from the excerpt without plugin

Steps to Remove the […] from the excerpt without plugin

After logging into WordPress dashboard go to Appearance > Editor from the menu at the left hand side.

Now locate the functions.php file

The location to the file may look like : /home/username/public_html/wp-content/themes/currently_active_theme/functions.php

Make a local backup of this file in case anything goes wrong and you may need to revert to previous stable code.

click on it to begin editing it.

Put this below code in your functions.php to remove the […] at the end of the excerpt.

function trim_excerpt($text) {
return substr($text, 0, -11);
}
add_filter(‘get_the_excerpt’, ‘trim_excerpt’);

This will remove ellipsis in wordpress excerpt without plugin

Let me know besumitbe@gmail.com/skype-bpshbp if you have any Query