Most recent post from another database

The WordPress wpdb class is a little different than the normal way of querying in that you run “vanilla” database queries. You can see documentation on the wpdb class on the WordPress docs: http://codex.wordpress.org/Class_Reference/wpdb#Run_Any_Query_on_the_Database Also, in regard to your code, you should be able to change the line here: $originaldb->query_posts( ‘posts_per_page=1’ ); To something like … Read more

Create dropdown list post

Hey @Ruriko … its a 3 step action. get the current category ID get the posts for this specific category get the posts into a select menu Please note that this code would use the first category id altough you might assign several categories to the same post. . <?php // FIRST CATEGORY NAME $category … Read more

XML-RPC and post_date

There are a couple of issues here. First of all, wp.editPost takes a fourth parameter before the content struct -> the ID of the post you’re trying to edit (should be an integer). Second, you’re passing a string for the post_date, so the client automatically converts this to a <string> tag before sending it to … Read more

slideshow is not showing in a post call with ajax

When you load a page that contains a normal static post, there is some JavaScript that is called on page load to instantiate your slider. Something like: jQuery(document).ready(function($){ $(‘.sliders’).someSliderScript(); }); This finds all of the elements that should have a slider applied and runs all the necessary code to set it up and make it … Read more

Display number of posts via adress bar?

If you’re asking to change the number of posts from 10 to something else, you can do one of the following 1) Submit the search query as ?s=key&order=ASC&posts_per_page=5 You can achieve this by adding hidden fields to the form. Just change the number to whatever you want 2) Go to Settings > Reading, change the … Read more

The short content by characters [duplicate]

There are no built-in WordPress functions to trim strings by character count. /** * Get a limited part of the content – sans html tags and shortcodes – * according to the amount written in $limit. Make sure words aren’t cut in the middle * @param int $limit – number of characters * @return string … Read more

Check to see if post is live before displaying the content

Your custom function show_post() uses get_page_by_slug() to retrieve the specified page. Looking at source, it doesn’t look like get_page_by_slug() uses post_status. So, you’ll need to query $post->post_status within your show_post() function if you want to account for it in the function output: <?php function show_post( $path ) { $post = get_page_by_path( $path ); $content=””; if … Read more

Sidebar links for different pages

Register a new sidebar by pasting this into your theme’s functions.php file: register_sidebars( ‘id’ => ‘patientedu’ ); Create a file called sidebar-patientedu.php and paste the following into it: <?php if (is_active_sidebar(‘patientedu’)) : ?> <div id=”sidebar”> <h2>PatientEdu Sidebar</h2> <?php dynamic_sidebar(‘patientedu’); ?> </div> <?php endif; ?> Then paste this whereever you want your sidebar to show up: … Read more