WP Admin default view mode for Custom Post Type

To change the mode URL variable but in the load try this: add_action( ‘load-edit.php’, ‘my_default_posts_list_mode’ ); function my_default_posts_list_mode() { $post_type = isset( $_GET[‘post_type’] ) ? $_GET[‘post_type’] : ”; if ( $post_type && $post_type == ‘my_post_type’ && !isset( $_REQUEST[‘mode’] ) ) $_REQUEST[‘mode’] = ‘excerpt’; } Got the “insipration” from here: Set Default Listing “View” in Admin

Creating a custom MCE view for your shortcodes [closed]

I had a lot of trouble finding information and examples of this, so here you go: https://github.com/dtbaker/wordpress-mce-view-and-shortcode-editor This converts a [shortcode] into a nice custom view to match the frontend, and adds an edit button for easy shortcode editing. <?php /** * Class dtbaker_Shortcode_Banner * handles the creation of [boutique_banner] shortcode * adds a button … Read more

Custom Post Type With Different Views

For example, let’s say that Property is the post type. We would like to display several different views (completed (built), for sale, and for rent.) Sure. Just make Completed, For Sale, and For Rent taxonomies for the Property post type. Look into WP_Rewrite class, too, and you can get greater control over url permalink structure.

select * from table where column = something or, when unavailable, column = something else

You can provide a custom ordering, then take the first row, like this: Explanation: The inner select’s order by field(LOCALE, ‘ge’, ‘_’) gets you the rows in the order you define – in this case German first if it exists, then English (you could add more languages to the list). The “trick” here is using mysql’s “non-standard” GROUP … Read more

Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy

Where are you calling this method from? I had an issue where I was attempting to present a modal view controller within the viewDidLoad method. The solution for me was to move this call to the viewDidAppear: method. My presumption is that the view controller’s view is not in the window’s view hierarchy at the point that it has been loaded … Read more

Attempt to present UIViewController on UIViewController whose view is not in the window hierarchy

Where are you calling this method from? I had an issue where I was attempting to present a modal view controller within the viewDidLoad method. The solution for me was to move this call to the viewDidAppear: method. My presumption is that the view controller’s view is not in the window’s view hierarchy at the point that it has been loaded … Read more