WordPress can’t find IXR_Client

You mean class-IRC.php or class-IXR.php? Just include the files before you call IXR_Client. I use such code to call IXR_CLIENT and it worked on my site: include_once( ABSPATH . WPINC . ‘/class-IXR.php’ ); include_once( ABSPATH . WPINC . ‘/class-wp-http-ixr-client.php’ ); $client = new WP_HTTP_IXR_CLIENT( ‘http://othersite.com/xmlrpc.php’ );

Can I make WordPress use a custom template for a child page

You can filter template_include and replace the single-community.php with a single-child-community.php. Example add_filter( ‘template_include’, function( $template ) { if ( ! is_singular() ) return $template; // not single if ( ‘communities’ !== get_post_type() ) return $template; // wrong post type if ( 0 === get_post()->post_parent ) return $template; // not a child return locate_template( ‘single-child-community.php’ … Read more

Get Pagination (WP-PageNavi) not to work

Couple of issues here; Don’t use get_posts for paginated queries. It legally breaks/ignore pagination as it passes no_found_rows=true to WP_Query. Further more, get_posts only returns the $posts property from the query object, and pagination needs other properties from the query object to calculate pagination. You can paginate get_posts, but it is a really messy affair, … Read more

Get Meta from Custom Field of Image URL

I can already tell that you’re using ACF – if you don’t want to change the return settings for the field, you can bypass ACF and just pull the image ID directly from post meta: $image_url = get_field( ‘my_field_name’ ); $image_id = get_post_meta( $post->ID, ‘my_field_name’, true ); $image_meta = wp_get_attachment_metadata( $image_id );

How to add meta boxes to Pages

I’ve got this working finally ($template_file == ‘page-tjenester.php’), so now my meta boxes shows up only when I use this specific page-template! This is the final code if someone is interesting; add_action(‘admin_init’,’my_meta_init’); function my_meta_init() { $post_id = $_GET[‘post’] ? $_GET[‘post’] : $_POST[‘post_ID’] ; $template_file = get_post_meta($post_id,’_wp_page_template’,TRUE); if ($template_file == ‘page-tjenester.php’) { // this will only … Read more

Programatically changing template of a page

Looking at the wp_postmeta table, you can see the page template is stored there. Therefore, a simple call to update_post_meta (codex) should do the trick : update_post_meta( $post_id, ‘_wp_page_template’, ‘my_template.php’ ); The filename and extension is necessary, as per my example.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)