How to Move Content From One WordPress Site to Another

Featured Imgs 13

Moving your WordPress site to another location can be a stressful and fiddly experience, not helped by the fact you can’t just simply move your files and database. No, that’s just not how WordPress works.

Fortunately, WordPress has a handy “Import” and “Export” tool built in. But unfortunately, it’ll only suit some basic requirements and you need to improvise a little to achieve other effects.

In this article, I’ll show you step-by-step how to migrate your WordPress installation’s content to a new place.

Let’s get cracking!

Before We Start: Back Up Your Website

Some WordPress installations or server setups may present you with unique challenges on migrating content. Although this article will deal with an additional unique eventuality (namely that you only want to transfer a part of your WordPress installation’s content), there’s no guarantee that the steps detailed here will unfailingly work for every setup.

It goes without saying that you’re solely responsible for your site, even when following this guide to the letter; there’s some database work involved depending on what you want to do, and if you accidentally delete a huge chunk of your site, that’s down to you. Basically, be careful with this!

For the purposes of this post, I’ve created two separate localhost installations of WordPress to provide you with pictures of each step. You might like to try moving your content to a test site to check it works.

To that end, I’d recommend making a backup of your entire site at this point. Of course, you do that regularly, don’t you? (If not, you definitely should be. Get to it.)

If you want to do this manually, remember to include both your database and site files (primarily because this includes your website’s Uploads folder).

Backing Up Files

You can create and download a ZIP of your site files via FTP. How to do this varies per FTP client but is generally fairly obvious. Make sure you download and securely store your backup compressed file – just as with any backup.

Backing Up Your Database

Login to your phpMyAdmin account and select the database in which WordPress is installed.

Select Export from the top menu. For most people, “Quick” options will be adequate. However, if you have tables other than the WordPress installation you want to back up in the same database, click Custom to select the tables you want to back up; all other options should remain untouched. Finally, click Go to download your database backup file (.sql format).

phpMyAdmin Database Export Options
Your WordPress tables are prefixed “wp_” by default – since I have two installations in the same database, mine are actually prefixed wpmudev_export and wpmudev_import. Here, I’m backing up the wpmudev_export files.

Hopefully, those backups won’t be needed, but it’s always advisable before embarking upon such work. If the site to which you’re migrating content already has content, make sure you back up that one too.

With precautions out of the way, let’s get to work!

Changing Your WordPress Installation’s URL? Transferring a Whole Site

If you’re just looking to change your website to a new URL or otherwise want to transfer absolutely everything from one installation to another, the good news is that you’ve picked the easy option. WordPress’s own import and export tools will work perfectly for you so no need to do anything too complicated under the hood.

Here’s how to transfer all your WordPress content – pages, images and files, posts and everything else – to a new installation.

Incidentally, it is probably easiest to create a new installation on your new server (or even the new location within a server) and import/export than to change your files’ configurations. However, if you’d rather do it that way, the WordPress Codex can advise. Your installation should be up-to-date with the latest WordPress version so it won’t be a problem, but if it’s not, upgrade your old installation first. If you really can’t update for some reason – such as keeping a plugin that doesn’t work with new versions – your new installation can be an old version. This is far from recommended because many old versions of WordPress have critical security flaws.

How to Move Content From One WordPress Site to Another

  1. Export From Your Old Installation
  2. Install the Importer
  3. Upload Your Content
  4. Assign the Content

1. Export From Your Old Installation

WordPress Export Page.
WordPress’s own Export Tool.

Go to your WordPress dashboard and select the Export item from the Tools section.

Because you’re exporting everything, it’s easy: keep the All content option selected and hit Download Export File.

An XML file will be created. Keep it in a safe place and go across to the installation to which you’re migrating.

2. Install the Importer

WordPress importer options.
The WordPress importers screen.
Importer Install screen

On the new WordPress installation, go once again to Tools, but this time select Import.

You will be shown a list of importers, from which you should select the WordPress option.

Click Install Now and wait for the importer plugin to download and install.

If it all works, you can click Activate Plugin & Run Importer on the next screen.

At this point, you’re all ready to import and the XML file you generated earlier comes into play.

3. Upload Your Content

Screen to upload WXR XML file
Upload the WordPress eXtended RSS (WXR) XML file you created earlier.

Click Choose File on the screen that follows and select the XML file you created on the old site.

Next, click Upload file and import.

4. Assign the Content

Importer Content Attribution Options.
You can import or add new author accounts, or attribute content to existing authors. Ensure you import and download attachments.

You’ll be given an option to assign content to existing users on the new site (if you have an account on both, you can assign your old posts to your new account), or create new users either with their old usernames or with a new one you select. This ensures all the content is attributed to an author account that exists on the new site.

If you have any images or files to move to the new site, make absolutely sure that you tick Download and import file attachments – it’s not selected by default.

Hit the Submit button and you’re done! The page may take a little longer than usual to load because it’s creating all the new rows on the database, but it will get through it. Just wait patiently for it to be processed and all of your content should be imported onto the new site ready for its life there.

Partial Content Movement

So that’s the easy bit out of the way. However, if you’re looking to export only some of your content, I’m afraid to say that WordPress’s tools probably won’t cater for your needs on their own.

Selecting All content is the only way to export your attachments (files that appear under the Media section). Therefore, if you want to transfer specific parts of the content and your images, you’ll either need to move everything across then delete it (time consuming for larger sites) or poke around in your files and database – which I shall show you how to do now.

The exporting and changing SQL that I’m about to show you will be demonstrated for moving attachments, but you can also use a similar methodology to transfer the whole database across. This is useful if you want to transfer everything but your XML file is too large to upload through the importer.

1. Select the Content You Want to Export

Venture once more to the Tools > Export screen to begin with.

Export screen with posts selected.
Here I have chosen to export only posts after mid-2010 from a certain author. You can also choose to export by status (eg. Published, Pending, Draft) or their Category. Other content types like pages (or Feedback, Portfolio, etc. if enabled) can be selected.

Once you’ve selected which content you’d like to export, click Download Export File as before. If there are multiple selections you’d like to make (eg. two authors’ posts in a date range, or someone’s posts and all pages), it’s entirely possible to go back and create multiple export files for each selection.

2. Import as Before

After you have all the WXR XML files you want, go to the new site and install the WordPress Importer as previously shown. You can upload your files (one at a time) as before and they’ll install the specific posts/pages/other content onto the site.

However, this is not the end, because you’ll notice that you still don’t have any attachments (eg. uploaded images) on your installation quite yet.

3. Duplicate Media Files

Go to your old installation’s FTP client and find the /wp-content/uploads/ folder. I’m using Windows 10’s File Explorer as my FTP client, but most should be able to compress files and download them.

Sending to compressed (zip) file.
Depending on your FTP client, compressing all folders within your uploads directory into a .zip file will be done through different methods.

Download the .ZIP file you generate and upload it to your new site’s FTP (or cut and paste it if you can access both sites through your FTP client).

Moving uploads .zip.
I’m cutting and pasting my compressed uploads across, but you can download and upload if you need to change between FTP clients.

You can then extract all the files from the compressed folder into the Uploads directory.

Unfortunately, that’s not the end of it; while your files are in the right place, your WordPress installation won’t know about them because the attachment details haven’t yet been copied across from the database.

No media attachments found.
Your new WordPress database doesn’t know about the files you’ve uploaded to the new server yet.

4. Export Attachment Posts

Head over to your old site’s phpMyAdmin database and find the wp_posts table (replace wp_ with your prefix as necessary).

wp_posts table SQL.
Again, I used wpmudev_exportposts, but replace the table name with the right prefix as applicable to your database.

At this point, you need to find the attachment posts (those are the media posts) so paste in the following SQL (changing the table name to have the right prefix if necessary) and hit Go.

SELECT 
 * 
FROM 
 `wp_posts` 
WHERE 
 `post_type` = "attachment"
Executed SQL query.
The SQL query will return only attachment posts.

Scroll to the bottom of the query results and check Show all so all attachment posts are showing. Once all rows are displayed, choose Check All then click Export.

At this point, things get a bit more complicated, but stay with me and follow the steps carefully and you should be fine.

Custom wp_posts Export with Format Specific Options
For the purposes of the picture, the options you’ll need to change have been moved up the page. You may need to scroll down to find them.
  1. Choose Custom to show all possible settings.
  2. Scroll down to the Format-specific Options section.
  3. Choose data.
  4. Leave everything else as it is and click Go.

5. Edit Your SQL

This step is necessary if your new installation has a different database prefix to the one from which you’ve just downloaded your SQL export file.

Edit the .sql file using a text editor such as Notepad++, finding and replacing the old prefix with the new prefix.

Find and replace prefixes in SQL file.
In my case, my original database was prefixed wpmudev_export and the one to which I will be moving the attachments is prefixed wpmudev_import!

If your prefixes are the same (eg. both tables are wp_posts), that’s fine and you can ignore this step.

6. Import Attachment Posts

wp_posts Import Page.
As ever, find the table with the right prefix as applicable!

Go to your new database and find wp_posts (or equivalent); click Import.

Click Choose File – make sure you click, don’t drag it in, as this means it won’t be uploaded in the right place – and select the exported SQL file.

Leave all other options as they are and execute the query by hitting Go. You’ll see a success message once it’s finished and all your attachments will now be visible under Media – although there’s a further step before your images will start showing up properly.

Media library showing just files, no images.
As you can see, none of the images actually show as images…yet!

7. Export Post Meta

wp_postmeta Custom Export Options
Again, the options you need to change are on this picture. You may need to scroll to find them.

Similar to the previous database work, this time find your old installation’s wp_postmeta table and select the Export tab.

Select Custom settings again and choose data rather than structure and data, just as before.

This time, also locate the Data Creation Options heading and select REPLACE as the function to use when dumping data.

Once again, click Go to create and download your SQL file.

8. Edit Your SQL

wp_postmeta SQL file editing

Again, you need to change the prefixes in your SQL file if the new database prefix will be different. You should also find all references to your old URL and replace them with the new one.

9. Import Post Meta

Go to your new wp_postmeta (or other applicable prefix) table and, exactly as before, import your edited SQL file into the new installation.

Your media library is now complete once more, ready to fit back into your transferred content (finally).

Completed Media Library
Finally, all your images show up and can be shown within content!

Finishing Up

If you’ve got through all that, well done – it’s a bit of a roundabout method just to transfer some images across with specific posts.

Of course, there are still catches with this: if you only want to migrate some of the images, you need to go through and pick out the folders (hopefully you want them by date or it would take forever) more carefully when uploading. You could also run into trouble with duplicate primary keys transferring wp_posts if you already had posts on the new installation.

Clearly, to make the Import/Export process more intuitive – rather than requiring such creative thinking with the databases behind the CMS – some work will need to be completed for a future WordPress release. While we wait, however, if you do need to move some of your content, this should work for you – it’s well worth the time!

If you’ve got any more ideas and methods for moving across parts of a WordPress installation with all the content in tow, we’d love you to share it with us in the comments. Likewise, let us know if you’re having any issues with these methods and we can try to give you a hand.

Update previously stored list of datetimes in a combobox, in a cycle for

558fe5180e0e8fc922d31c23ef84d240

Hi, how can I make sure that all the datetime stored previously by user input will be updated in a cycle for?
I explain better the structure
Combobox2 <----- is where list of datatime are previously stored
Combobox3 <------- is where remaining time is given by a substraction of two dates, stored in days remaing.
The fact, is now that these values are only stored and doesn't change with time passing by.
This is my code

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click

        For i = 0 To ListBox1.Items.Count
            Dim d As DateTime = DateTime.Now
            Dim d2 As DateTime = ComboBox2.SelectedItem(i)
            Dim dysdiff As String = (d - d2).Days.ToString()
            ComboBox3.SelectedItem(i) = 365 - dysdiff & " Days"
        Next
    End Sub

Creating Speech Balloons With the WordPress Block Editor

Wp Plugins

I do not know how I overlooked LIQUID SPEECH BALLOON. The plugin is less than a month shy of being three years old, and I follow block-related projects religiously. This one slipped through the cracks, at least until I haphazardly stumbled upon it when searching for something else entirely.

It is also relatively popular for a single-block plugin. There are not that many with more than 10,000 active installs. I had to know what it was doing to draw such a crowd.

In the comments on yesterday’s post about Automattic’s Livro theme, Nick Hamze wanted to know where all the fun theme designs were. Perhaps it was fortuitous timing that I also happened to be playing around with a plugin that might fit the bill. Sure, it is not a theme, but it can definitely be used to spruce up an otherwise boring or plain design.

So, I spun up a few Speech Balloon blocks and just had fun creating a chat with a some cartoon animals:

Four rows of speech balloons with cartoon animals making sounds.  Includes a cat, lion, chimp, and panda.
Inserting and customizing multiple Speech Balloon blocks.

I tend to gravitate toward clean, open-canvas themes because they allow me to add all the fun elements via the post content. That is why I love finding plugins like LIQUID SPEECH BALLOON. They add that visual flair to pages that can sometimes be boring.

Using the plugin’s Speech Balloon block is straightforward. It presents users with a single section for inserting rich text content.

A speech balloon with a default user avatar and placeholder text, "Speech," in the WordPress block editor.
Default Speech Balloon block.

In the block options sidebar, users can choose an avatar. They can also make several design adjustments, including background and text colors.

The block is falling slightly behind the times, though. Since the plugin’s release nearly three years ago, WordPress has added several new design components that could be used to make its block even better, such as padding, border, and typography controls.

The plugin can also be used for testimonials or other types of reviews. It works well enough for more business-friendly layouts if that is the sort of thing you are after.

Two columns of testimonials. Both show a user avatar on the left and a text review in the box on their right.
Creating testimonials with the Speech Balloon block.

The plugin’s biggest failure is in how it handles avatars. It is also why it does not make for the best option for testimonials. Users cannot add avatars directly via the block. Instead, they must register them via an entirely separate admin screen. Then, they can select from their saved avatars list within the block.

Under the Settings > LIQUID SPEECH BALLOON page, the plugin presents users with several rows of fields. They can add a name and image URL for each avatar.

10 rows of input fields in a settings form.  Each row has a Name field and an Image URL field.
Plugin’s avatar settings.

This is where the user experience falls apart a bit. There is no way to upload avatars on this screen. Instead, users must upload them via their media library, copy the URL, and paste it into the image URL field.

The plugin provides the necessary documentation and links to work through this process. The overall experience is simply lackluster.

However, if users only need a limited number of avatars, the system works well enough once everything is uploaded. The images are always available whenever inserting the Speech Bubble block — no need to search through the media library or upload a new one.

I am not sure if this will go in my plugin toolbox. Outside of a few stylistic elements, such as the speech bubble’s tail, users could readily recreate something similar with a few blocks, as shown in the following screenshot:

Two speech bubbles.  The first has a Panda next to it.  The text reads, "Hello, how are you doing?"  The second has a zebra and the same text.
Custom speech bubbles pattern.

Within a few minutes, I created this with what is already available in core WordPress, and I actually had several more design choices by doing so. I could see keeping a block pattern on hand for such a layout in the future.

For those who want a quick and easy solution without all the fuss of mixing and matching blocks, LIQUID SPEECH BALLOON would be the better option.

Clean all my settings VB.NET

558fe5180e0e8fc922d31c23ef84d240

Hi, how can I clean all saved settings in my.settings ? Do I need only to put
my.settings.[name].clear() or a My.settings.reset() can do a good job for all the user setting added into the program?
Also how can I add an exception if there is nothing in that setting or all settings? Can I put like
the isnullorempthy and referring it to that particular setting?

If ask = Msgboxresult.Yes then
my.settings.[name1].clear()
my.Settings.reset()
if ask = msgboxresult.no then
end if

WordPress 5.9 to Introduce New API for Locking Blocks

Category Image 091

The advent of block themes delivers more creative power into the hands of users, but there are times when theme authors may want to lock down key elements of a design and its designated content areas. First introduced in Gutenberg 11.6, the upcoming WordPress 5.9 release will include a new API for locking blocks.

Template level locking has been available in Gutenberg for a few years, allowing developers to lock the template on the UI so that users can’t manipulate the blocks. This new API offers more granular control that can be applied on the block level and override template locking.

“Instead of applying a lock to all inner blocks, you can apply it selectively to individual blocks via the lock attribute,” Marcus Kazmierczak said in the dev note. “The block level locking would supersede the inherited templateLock value. You can choose to lock moving or removing a block.”

One of the primary use cases for locking individual blocks, cited in the ticket proposing the new API, is where one might lock the “post-content” block of a single template so users can’t remove it.

“Another use case that we’re building for is having a Checkout Block with different blocks that act as fundamental steps, we don’t want people to delete or move those steps since they’re fundamental and their order is also important, but we want to allow people to select them, access settings, and insert blocks in between them,” WooCommerce engineer Seghir Nadir said.

Kazmierczak’s dev note demonstrates how developers can lock a specific block in a pattern and explained how block level locking is not inheritable.

“If a block is locked from being removed, its children can still be removed,” Kazmierczak said. “If you want to apply locking on children as well, add templateLock to the inner block component, or templateLock attribute to supporting blocks.”

For more information on the new locking mechanism, check out the Block Editor Handbook and the code examples in the dev note.

How to Change the WooCommerce Shop Page Title (Quick & Easy)

Set Up Woocommerce

Do you want to change the shop page title in WooCommerce?

By default, your main shop page is simply called ‘Shop’. You may want to change the default title to be more descriptive and engaging, and better reflect your brand.

In this article, we’ll show you how to change the WooCommerce shop page title easily.

How to change the WooCommerce shop page title (quick & easy)

Why Change the Shop Page Title in WooCommerce?

When you install WooCommerce, it will automatically create pages like your shop page, account page, checkout page, and more.

By default, the shop page title will be ‘Shop’, but you can change this to anything you want, like ‘Boutique’ or ‘Store’ or something more detailed and descriptive. Overall, this can help create a better shopping experience and help build trust with your visitors.

Customizing your shop page title can also help your WooCommerce search engine optimization. Google and other search engines look at the words used in page titles to determine how to rank them in search results. If your shop page title is more descriptive, it can help you get more traffic to your online store.

With that said, let’s show you how to easily change the WooCommerce shop page title. Simply use the quick links below to jump straight to the method you want to use.

Method 1: Changing the WooCommerce Shop Page Title with Built-in WordPress Settings

The easiest and most beginner friendly way to change the shop page title in your online store is by using the built-in settings.

To change the title of your shop page, simply go to Pages » All Pages. You’ll need to find the page that says ‘Shop – Shop Page’ and then hover over it and click the ‘Edit’ button.

Go to all pages and open shop page

From here, you can enter a new page title at the top of the page.

Make sure to click the ‘Update’ button to save your changes.

Add new shop page title

Now, you can visit your shop page, and you’ll see your new shop page title live.

Changing your shop page title this way will update your breadcrumbs and navigation menu too.

Shop page new title example

Method 2: Changing the WooCommerce Shop Page Title by Adding Code to WordPress

Some WooCommerce themes might not give you the option to change your shop page title.

To do this, you’ll need to add code to WordPress. If you haven’t done this before, then see our guide on how to copy and paste code in WordPress.

Then, you can add the following code snippet to your functions.php file, in a site-specific plugin, or by using a code snippets plugin

add_filter( 'woocommerce_page_title', 'new_woocommerce_page_title');
 
function new_woocommerce_page_title( $page_title ) {
 
  if( $page_title == 'Shop' ) {
 
    return "New Shop Title";
 
  }
 
}

Make sure you replace the ‘New Shop Title’ with your own shop page title in the snippet above.

Now, you can visit your online shop page to see your new title live. You’ll notice this method doesn’t change the shop page URL or WooCommerce breadcrumbs, but only changes the title on the page itself.

Shop page title example with code

Method 3: Changing the WooCommerce Shop Page SEO Title with a WordPress Plugin

Another way to change your WooCommerce shop page title is by changing the shop title that shows up in the search engines, which is called the SEO title or title tag.

This can be a great way to get more traffic and target more relevant keywords related to your online store.

The easiest way to do this is by using the AIOSEO plugin. It’s the best WordPress SEO plugin in the market used by over 3 million websites. 

AIOSEO

You can use the plugin easily optimize your SEO title to improve your search engine rankings.

For more details on setting up the plugin, see our guide on how to setup All in One SEO for WordPress correctly.

After that, you can easily change your shop page SEO title by opening up your shop page and scrolling down to the ‘AIOSEO Settings’ box beneath the page editor.

You can use smart tags to automatically generate the shop page title, or enter a custom title instead.

AIOSEO shop page title

If you want to fully customize the title and page design of your WooCommerce shop page, then we recommend using SeedProd.

It’s a drag & drop design builder that lets you customize every Aspect of your WooCommerce store.

SeedProd WooCommerce Design Builder

We hope this article helped you learn how to change the WooCommerce shop page title. You may also want to see our expert pick of the best WooCommerce plugins and best WooCommerce hosting for creating a successful online store.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Change the WooCommerce Shop Page Title (Quick & Easy) first appeared on WPBeginner.

countdown with 3 label, (hh:mm:ss) when reach 1 minute timer freeze

558fe5180e0e8fc922d31c23ef84d240

Hi, I have a issues, in this code I have a countdown with function declared, the issues now is that, if starting the time with only seconds timer go well but if the timer go to one minute if button is clicked timer suddently stop. Is there anything wrong with the code?

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

        If Label5.Text = 0 AndAlso Label8.Text = 0 AndAlso Label7.Text < 59 Then
            Label7.Text = Label7.Text - 1.ToString
            If Label5.Text = 0 AndAlso Label8.Text = 0 AndAlso Label7.Text = 0 Then
                Timer1.Stop()
                MsgBox("timer out", MessageBoxButtons.OK)
            End If
            If Label7.Text = 0 AndAlso Label8.Text > 1 Then
                Label8.Text = Label8.Text - 1.ToString
                Label7.Text = 59
            ElseIf Label5.Text >= 0 AndAlso Label8.Text >= 0 AndAlso Label7.Text = 59 Then
                Label7.Text = 59
                Label8.Text = 59
                Label7.Text = Label7.Text - 1.ToString
                Label8.Text = Label8.Text - 1.ToString
                Label5.Text = Label5.Text - 1.ToString
            End If
        End If
    End Sub

How To Use Sticker Paper

Featured Imgs 23

Sticker papers are getting several uses from time to time in the current world. Traditionally, people used to get sticker papers from the shops and stores where they came with already made appearances. Today, due to technological advancement, you can create customized sticker paper for your use. Sticker papers come in various forms to meet...

The post How To Use Sticker Paper appeared first on DesignrFix.

API Prototyping with Postman

Featured Imgs 26

Introduction

Whether you’re a longtime Postman developer or new to the platform, Postman brings you all the tools you need to make the process easier, faster, and more streamlined.

In this article, we’ll show how Postman can help you start building the core of your API-driven integration on both sides of the API—either as the provider or the consumer.

Problems in sorting element inside an array of object.

558fe5180e0e8fc922d31c23ef84d240

i have initialized the elements of the array by reading the strings from a file, however when I call the sort function, either the program crashes or it just outputs NULL. What could be a more efficient way to store data from a file?

the file that I have opened contains the following text:
"
ppp zaeem na2 lun
pti farea na1 balla

"

#include <iostream>
#include <string>
#include <stdlib.h>
#include <Conio.h>
#include <cstdlib>
#include <string>
#include <string.h>
#include <cstring>
#include <fstream>
using namespace std;

class candidate
{
public:
    string party;
    string name;
    string constituency;
    string symbol;

    candidate()
    {
        party = "";
        name = "";
        constituency = "";
        symbol = "";
    }
};

candidate *candi = new candidate[3];
int size = 0;

void read_into_array()
{
    int i = 0;
    string name, party, consti, symb;
    ifstream a("new.txt");
    if (!a)
        cout << "file not found." << endl;
    else
    {

        a >> party >> name >> consti >> symb;
        while (!a.eof())
        {   

            candi[i].party = party;
            candi[i].name = name;
            candi[i].constituency = consti;
            candi[i].symbol = symb;
            a >> party >> name >> consti >> symb;

            size++;
            i++;
        }
        a.close();
    }
}
class voter
{
public:
    void show_all_candidates()
    {
        for (int i = 0; i < size; i++)
        {
            cout << "Candidate's Name:  " << candi[i].name << endl;
            cout << "Candidate's Constituency:  " << candi[i].constituency << endl;
            cout << "Candidate's Party'" << candi[i].party << endl;
            cout << "Party Symbol:  " << candi[i].symbol << endl;
        }
    }

    void sort_by_name()
    {
        for (int i = 1; i < size; i++)
        {
            for (int j = 1; j <size-i; j++)
            {
                string temp=" ";
                if (candi[j].name > candi[j + 1].name)
                {

                    temp=candi[j].name;
                    candi[j].name = candi[j + 1].name;
                    candi[j + 1].name = temp;

                    temp=candi[j].constituency;
                    candi[j].constituency = candi[j + 1].constituency;
                    candi[j + 1].constituency = temp;

                    temp=candi[j].party;
                    candi[j].party = candi[j + 1].party;
                    candi[j + 1].party = temp;

                    temp=candi[j].symbol;
                    candi[j].symbol = candi[j + 1].symbol;
                    candi[j + 1].symbol = temp;
                }
            }
        }
    }
};

int main()
{
    voter obj_voter;

    read_into_array();
    obj_voter.sort_by_name();
    obj_voter.show_all_candidates();
   // obj_voter.sort_by_name();
}