Displaying post/page info on a homepage using get_post()

I worked it out, when in the admin area of a page/post you can find the post ID in the browser URL: http://localhost/newsite/wp-admin/post.php?post=1807&action=edit So the previous dev simply uses this page as a ‘parent’, and refers to it as they set $id = get_post(1807); Now the query find posts/pages that a ‘children’ of this page.

Get post by Category in custom template

<?php $categories=get_categories(”); foreach($categories as $category) { echo ‘<p>Category: <a href=”‘ . get_category_link( $category->term_id ) . ‘” title=”‘ . sprintf( __( “View all posts in %s” ), $category->name ) . ‘” ‘ . ‘>’ . $category->name.'</a> </p> ‘; echo ‘<p> Cat ID: ‘. $category->cat_ID. ‘</p>’; // The Query $id_cat = $category->cat_ID; $args = array( ‘cat’ => … Read more

Modifying WordPress XML-RPC Built-Ins

Figured it out. $post_obj[‘permalink’] = my_getDraftPermalink( $post_obj[‘post_id’] ); That’s the correct syntax for getting the post_id. Then a custom function that gets the permalink the same way as the post dashboard UI is required. The dashboard uses get_sample_permalink and not get_permalink, which will return the draft path if the post isn’t live. function my_getDraftPermalink ( … Read more

Function to get the name in database table from the comma separated string

Not tested but this should work: add_action(‘manage_pages_custom_column’, ‘display_page_custom_cols’, 10, 2); function display_page_custom_cols($col_name, $post_id) { global $wpdb; $user_group = $wpdb->get_results(“SELECT * From custom_user_group”,OBJECT_K); if (‘user_group’ == $col_name) { $pages = explode(‘,’,get_post($post_id)); $output = array(); foreach ($pages as $page ) { $output[] = $user_group[$page]->GroupName; } echo implode(‘,’,$output); } }