How to move WordPress to another hosting

  1. Create backup of files and database and put it on your computer.
  2. Go to new hosting panel.
  3. Create new database user and new database. Import tables to new database.
  4. Upload files to www folder or public-html folder via FTP or in cPanel
  5. Open wp-config.txt and make changes
<!-- wp:paragraph -->
<p>// ** MySQL settings - You can get this info from your web host ** //<br>/** The name of the database for WordPress */<br>define( 'DB_NAME', '***' );</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>/** MySQL database username */<br>define( 'DB_USER', '***' );</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>/** MySQL database password */<br>define( 'DB_PASSWORD', '***' );</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>/** MySQL hostname */<br>define( 'DB_HOST', 'localhost' );</p>
<!-- /wp:paragraph -->

6. Go to website and if everything is correct, website will appear.

7. Go to phpMyAdmin and make changes in wp_options table.

Now everything is ok. 🙂

How to add tabbed menu in WordPress

I was asked to created tabbed menu for WordPress website where some pages show posts from chosen categories and others show single post. But unfortunately I could not find the decision on the web so I made my own.

Here it is:

I went to header.php in my template and modified it this way:

 <div class="w3-bar w3-black">
    <button class="w3-bar-item w3-button tablink w3-red" onclick="openCity(event,'Aboutme')">About me</button>
    <button class="w3-bar-item w3-button tablink" onclick="openCity(event,'Photos')">Photos</button>
  <div id="Aboutme" class="w3-container w3-border city">
 <div id="Photos" class="w3-container w3-border city">

Also I added a script:

function openCity(evt, cityName) {
  var i, x, tablinks;
  x = document.getElementsByClassName("city");
  for (i = 0; i < x.length; i++) {
    x[i].style.display = "none";
  tablinks = document.getElementsByClassName("tablink");
  for (i = 0; i < x.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" w3-red", "");
  document.getElementById(cityName).style.display = "block";
  evt.currentTarget.className += " w3-red";

Displaying posts from current category WordPress without plugin

<?php	query_posts('cat=3'); // point your category number instead of 3
while (have_posts()) : the_post();?>
<?php echo '<div class="blos">'; ?>
	<div class="thumbnail"><?php echo get_the_post_thumbnail(); ?></div>
		<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
		<?php the_content(); 
		echo '</div></div>';

This method helps you show Advanced Custom fields in post content and also prevents jQuery conflicts if you need to show posts from category as a tab of WordPress tabbed navigation.

Another way

You can also add and setup recent posts from chosen category in edit page visual editor. Just press plus button and type latest posts in the search form. Then in the right column choose category name and fill all the form fields needed. That’s it. You can edit HTML layout of this block in wp-includes/blocks/latest-posts.php

How to display posts from current category WordPress

  1. Install plugin “List category posts” and activate it.
  2. Go to Posts –> Categories in the left menu in WordPress admin.
  3. Find the category and find it’s ID in the list in the right part. (for example, category ID = 4)
  4. Go to page edit and paste the code in HTML format [catlist id=4] (as Custom HTML block) or paste it as shortcode (as Shortcode)

Remember! Don’t paste it directly. It will be wrapped in <p></p> and will display [catlist id=4]…

5. Save the post and enjoy it)))

ACF (Advanced custom fields)

What do I use when I need to create easy-to use and lightweight functionality to let business owners add additional information about some issue in WordPress admin panel?

The answer is – AСF plugin (Advanced Custom fields).

Small instruction:

  1. Install and activate plugin
  2. Go to “Custom Fields” in menu bar in Admin panel of WordPress
  3. Press “Add new” and name new group. 
  4. Choose conditions (in what types of pages, posts custom fields will be displayed). For example, if you need to display location input only in tours category posts and don’t want them show in food category posts, set the following condition “Post Category” is equal to “Tours”.
  5. Go to one of the posts in choosen category and edit it. You will see input fields in the bottom. 
  6. Fill them.
  7. Go to FTP (wp-content –> themes –> theme name –> single.php
  8. After get_template_part( ‘entry’ ) insert the following code:

<?php echo get_field(‘location’); ?>

It will display the content that you write down in input field named “location” in posts in category “Tours”