I’m moving my website to a new host and would like to move only my posts and images to the new site. I don’t want to use WP export because I’ve had bad experiences going that route. I don’t want to copy the entire database, just copy the posts and images in the database. What […]
After reading many question and answers and many had asked the same question I have been following the same instruction as the people instructed but my bad it’s not working I have used dbDelta($sql) $wpdb->query($sql) It’s not working sample code <?php /* Plugin Name: ContactUs Plugin URI: Description: Simple Plugin Developed for Testing purpose Version: […]
I see that your can sort media by a numbered order in the media gallery for a post. But what table is this order stored in? I want to use this order to also order the images the same way in my posts.
I’m using the list-category-post plugin – is it possible to display the list of posts in a table? I want to have a dynamic table showing all the posts in a category, so a user can search the table and select a column to sort by. Is this possible? Thanks,
I am trying to return the number of reviews for a given page ID, I have this so far: <?php global $wpdb; $countreviews = $wpdb->get_var($wpdb->prepare(“SELECT COUNT(ID) FROM $wpdb->wpcreviews WHERE page_id = ID”)); echo ‘Number Of Reviews ‘ . $countreviews . ”; ?> Its not working and I assume it’s the end part page_id = ID […]
I have a custom table in the WP database which I can display fine, with pagination, using the following code: <?php global $wpdb; $rows_per_page = 50; $current = (intval(get_query_var(‘paged’))) ? intval(get_query_var(‘paged’)) : 1; $rows = $wpdb->get_results( “SELECT * FROM nc_rates_eng”); global $wp_rewrite; $pagination_args = array( ‘base’ => @add_query_arg(‘paged’,’%#%’), ‘format’ => ”, ‘total’ => ceil(sizeof($rows)/$rows_per_page), ‘current’ […]
I am trying to implement WP_List_Table for my plugin. I have gone through this tutorial and using its sample plugin. I have installed this plugin and just changed table name and done slightly modification in the following functions: column_name,get_columns and get_sortable_columns Now it is showing the table but instead of value it is showing array […]
I’m having trouble passing a table variable to $wpdb->prepare(); Here is functioning code: $table = $wpdb->get_blog_prefix( $blog_id ) . ‘my_table’; $voters = $wpdb->get_row($wpdb->prepare(“SELECT * FROM $table WHERE user_id= %d AND post_id = %d;”, $user_ID, $post->ID )); This works great. However I think I should also be including my table in the prepare statement. But, it […]
Why for example field in wp_posts table is called “post_title” instead of “title”? Is this somehow related to b2cafelog legacy code for backward capability? Or is there other explanation for this? This question applies to other core WordPress tables too.
I’ve written a simple WordPress plugin to create a new database table. The new table ought to be created when the plugin is activated. When I try to activate the plugin, I get the following error: The plugin generated 3989 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with […]