Showing Error(TAble already exist)

Try with this, It will delete existing wp_commentmeta table then create ‘wp_commentmeta’ table : DROP TABLE IF EXISTS `wp_commentmeta`; CREATE TABLE `wp_commentmeta` ( `meta_id` bigint(20) UNSIGNED NOT NULL, `comment_id` bigint(20) UNSIGNED NOT NULL DEFAULT ‘0’, `meta_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `meta_value` longtext COLLATE utf8mb4_unicode_ci ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Is there a full explanation on how to share a database with two WordPress sites on same server?

It is possible to add custom queries to the 2nd site, and pull posts from the first site: <?php $mydb = new wpdb(‘root’,’root’,’dev1′,’localhost’); $query_result = $mydb->get_results(“SELECT * FROM $wpdb->posts WHERE post_status=”publish””); if ($query_result) { foreach ($query_result as $result) { setup_postdata($result); get_template_part( ‘content’, get_post_format() ); } } else { echo “<p>Not found</p>” ; } ?> See … Read more

Insert into db with foreach problem

(See comments) $wpdb->insert( ‘produse’, array( ‘id’ => $post_id, ‘pret’ => $produs[‘pret’], ‘gramaj’ => $produs[‘gramaj’], ‘numar_produs’ => $produs[‘numar_produs’] ), array( ‘%d’, ‘%s’, ‘%s’, ‘%d’ ) );

Theme Options – localhost to new url

The way I’ve always migrated sites is not by search and replacing, but just by changing two fields in wp_options: siteurl and home. Try doing only this, no search and replace, and see if it fixes your options page / widgets. It may be that by replacing all instances of “localhost,” you’re actually impairing your … Read more

Importing Concrete5 content to WordPress

If you go to WordPress’s Tools » Import page in your site’s Admin section (eg, http://example.com/wp-admin), you’ll find that it can import, among other things, HTML pages. So if you have a way to export your Concrete5 site to a directory of HTML pages, you should be able to import them that way.

2 WP websites same content different themes

What I would do is to use switch_to_blog function just before posts queries are run on the database, and then restore the current blog just after the query. I assume that the blog where your content is is the main one (1). Just put the following lines in your second blog theme’s function.php : add_action(‘pre_get_posts’, … Read more

how to add limit records in wordpress query

What you want to do, can be achieved by means of the WP_Query class. $query = new WP_Query(array( ‘post_type’ => ‘quote2’, ‘posts_per_page’ => 10, // or something else )); Now you can work with $query like: if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post; ?> <h1><?php the_title(); </h1> <?php the_content(); <?php } else { // No … Read more

database search feature

If you want to use WordPress you can download a custom post type plugin (such as Custom Post Type UI), create your Book post type; another plugin to generate your form for adding books (Gravity Forms + this looks good, or a similar solution, or create a form by hand). Then tweak the default WordPress … Read more