Magento Engineer
social
Journal

Programming Blogs to Improve Your Coding Skills!

The industry's top wizards and other experts share their advice and research findings.

How to Move Your Blog/Website from WordPress.com to WordPress.org?

Many beginners often start with WordPress.com, but they soon realize its limitations and want to switch to the self-hosted WordPress.org platform.

In this step by step guide, we’ll show you how to properly move your blog from WordPress.com to WordPress.org.

Step1 - Login in the wordpress.com admin.
Step2 - Check "All-in-One WP Migration" from left sidebar and if it is not availble in your website then ping to  WordPress.com support team to add this.

Step3 - Open All-in-One WP Migration and click on export.

Step4 - Here you will see multiple export options, now choose FILE.
Step5 - Download will be started.

Step6 - The exported file will be in "wpress" format.
Step7 - Now run below command to extract and you will get Database and all wordpress files including plugin,theme,uploads.
Command: npx wpress-extract migration.wpress

Step8- Change wp-config.php and URL's from database and upload on new server.

That's it.
:) Enjoy

Ad comes here
Ad comes here

How do I add a external CDN CSS OR jQuery in WordPress theme header?

Rather then loading the stylesheet in your header.php file, you should load it in using wp_enqueue_style. In order to load your main stylesheet, you can enqueue it in functions.php

function bootstarp_to_head() {
    echo "<link href='https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css' rel='stylesheet' type='text/css'>";
}
add_action( 'wp_head', 'bootstarp_to_head' );

This will includes in theme header.

Ad comes here

How do I add a custom stylesheet in WordPress?

Rather then loading the stylesheet in your header.php file statically, you should load it in using wp_enqueue_style. In order to load your main stylesheet, you can enqueue it in functions.php

function theme_styles()  
{
    wp_register_style( 'responsive', get_template_directory_uri() . '/assets/css/responsive.css' );
    wp_enqueue_style('responsive');
    
}
add_action('wp_enqueue_scripts', 'theme_styles');

Ad comes here

How to create wordpress theme?

Introduction to WordPress Theme Development.

Create theme directory under the wordpress wp-content theme folder.
e.g Theme Name : developer
Now add basic files in the theme folder.
index.php
style.css
page.php

Above are very basic files to create wordpress theme.

Below are the some other files to improve your theme functioanlity.
header.php
footer.php
page.php
single.php
functions.php
404.php
screenshot.png

Using these template files you can put template tags within the index.php master file to include these other files where you want them to appear in the final generated page.

To include the header, use get_header().
To include the sidebar, use get_sidebar().
To include the footer, use get_footer().
To include the search form, use get_search_form().

Most Action Hooks are within the core PHP code of WordPress, so your Theme does not have to have any special tags for them to work. But a few Action Hooks do need to be present in your Theme, in order for Plugins to display information directly in your header, footer, sidebar, or in the page body. Here is a list of the special Action Hook Template Tags you need to include:

wp_enqueue_scripts
Used in the theme functions file. Used to load external scripts and stylesheets.

wp_head()
Goes in the <head> element of a theme, in header.php. Example plugin use: add JavaScript code.

wp_footer()
Goes in footer.php, just before the closing </body> tag. Example plugin use: insert PHP code that needs to run after everything else, at the bottom of the footer. Very commonly used to insert web statistics code, such as Google Analytics.

wp_meta()
Typically goes in the <li>Meta</li> section of a Theme's menu or sidebar; sidebar.php template. Example plugin use: include a rotating advertisement or a tag cloud.

comment_form()
Goes in comments.php directly before the file's closing tag (</div>). Example plugin use: display a comment preview.

Ad comes here
Error's and solution's
Update Cookies Preferences