How can I modify following code?
global $wp_query; $maxnum = $wp_query->found_posts;
is querying db2 instead of db1.
<?php /*<a target="_blank" href="https://cblive.it/wp/wp-content/uploads/2014/05/codice_autoregolamentazione.pdf"><img src="https://cblive.it/wp/wp-content/uploads/2014/05/codiceBtn.png" /></a>
*/ ?><div id="appuntamenti_widget">
<h3><a href="/notizie-molise/">Notizie dal Molise</a></h3>
<div class="content">
<?php
query_posts(array(
'post_type'=> 'appuntamenti',
'posts_per_page'=>10
));
while(have_posts()) : the_post();
global $wp_query; $maxnum = $wp_query->found_posts;
?>
<div id="featured-<?php the_ID();?>">
<h2 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'themejunkie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?> <?php the_post_thumbnail(featured-thumb); ?></a>
</h2>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>
</div>
Any help is greatly appreciated.
Thank you
I’m currently writing a plugin for handling posts as events which stores a timestamp in metakey called e.g. ‘time’.
While an event can have multiple occurences there can be several values with the same meta_key per post.
Now I would like to query something like get all meta by key 'time', sorted by the value and grab all posts by the post-ids of the metas
for keeping the posts still sotrted by date and allowing the posts to appear more than one time (because of the several occurences).
the meta-query is easy but than querying the posts one by one by their ID seems to be quite inefficient, doesn’t it??
any ideas?
]]>I am wondering if I will break something if I do the following inside my theme’s index.php?
global $wpdb;
$wpdb = new wpdb(‘myuser’, ‘mypass’, ‘otherdb’, ‘myserver’);
do stuff…
assign back to original
global $wpdb;
$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
I want to do this to get some info from another wordpress that I run on the same server.
Thank you for an answer.
]]>How do I erase duplicates in mysql?
]]>Using WordPress’s built-in bulk edit facility would mean applying the process to 214 ‘Edit Posts’ pages, 15 posts at a time.
Does anyone know of a less laborious way of achieving what I want to do?
Thanks
]]>The problem starts when I add the following into the .php file to make the page look like the rest of my WP site
<?
require('wp-blog-header.php');
get_header();
After adding that in I no longer get any data from the MYSQL database that it uses.The page displays but the table is empty.
My database connector is this:
require('database.php3');
$db=MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
@mysql_select_db("$dbName") OR DIE(error(mysql_error()));
database.php3 holds the variables for accessing the database and all of those variables read correctly. As I have echoed them out and all were shown correctly.
The other issue I am having with this is I included this at the bottom of my .PHP file to include the footer and sidebar. But those 2 items do not display.
get_sidebar();
get_footer();
Anyone have a clue as to why they do not display??
I appreciate any help..
Rick
1. Plugin A creates a new wpdb object to access a second database, using the following line within a PHP function:
$lwpdb = new wpdb( $user, $pass, $db, $host );
2. Plugin B attempts to reference the wordpress database via the wpdb object created by wordpress, using these lines within a function:
global $wpdb;
$sql = "select * from $mi_table_name";
$results = $wpdb->get_results( $sql, ARRAY_A );
3. Then the fun begins. Plugin B’s query gets run against the database referenced by Plugin A. I know that this is happening by the error message, which clearly states that the query is failing due to lack of select privileges on Plugin A’s database.
This has to be either a bug or a failure to properly document the behavior of the wpdb object.
]]>Ok, I have 2 sites (www.reelgroove.com – main site and www.gregdorban.co.uk). I do not want to update info on both sites as it will be largerly similiar. So, I seek to log into reelgroove.com wordpress admin and when new posts (in certain catagories) are added, they automatically update gregdorban.co.uk.
I have played with the wp_rss func – however this only shows the title and not full post as desired. (and do not believe it to have this additional functionality, nor be able to format the title, post etc correctly even if could display all.)
I have thought about linking gregdorban to the same database (but do not really want to have to as on different domain).
So, to summarise, I seek post content in select catagorises to be shown in full on secondary site different domain (as seen on primary site). What are the ways achiving this?
THANKS!!!
Note: I will change the layout of gregdorban.co.uk once functionality is working correctly.
]]>Example i would like to run 2 wordpress blogs with the same content but with different layouts, and different plugins. I would need to share the posts but would need to keep 2 separate databases for the blogs internal settings like themes, and comments.
]]>I have an existing site. I want to split out some subsites that utilize the same content, users, etc. The purpose of the subsites is to display just one category of content. Essentially I am segregating content types for better user and advertiser targeting. The master site will still exist, and pulls all categories together.
Here is the kicker though, each of these subdomains will use the essentially the same theme, but with different options. The different options are because the theme needs to display different categories of content. (Magazine style theme)
So I know I need subdomains, which I have setup. Each subdomain essentially contains the same information, theme files (which will be modified once I get this working) etc. The wp_config files all point back to the same database, because I want to share content. And that all works, I essentially have cloned my site to the subdomain. However the issue is I need a customize the options for each site, so I need to utilize different options tables for each site.
I don’t see anyplace where this is possible. I found the table array in wp-db.php, and modified the name of the options table there (var $tables = array), but when I do that, the site fails to install.
I’ve gone round and round with several plugins, and various ways of installing, but I can’t find anywhere which allows me to use a different options table. I’m by no means an expert, but I’m competent problem solver when it comes to working an issue like this. However I have apparently exhausted my capabilities at this point. Anyone have any experience, thoughts? Any help is greatly appreciated
]]>