Buch & Berger

  • Angebot
  • Agentur
  • Blog
  • Kontakt
  • Search

Post Type Switcher: WP Plugin Notes

Post Type Switcher adds a simple post-type drop-down to the post editor interface, allowing you to reassign any post to a new post type.

Customization

Use the pts_post_type_filter to enable all available post types:

add_filter( 'pts_post_type_filter', 'filter_pts_post_type_filter', 10, 1 ); 
/**
 * Post Type Switcher: Filter Post Type Arguments
 *
 * By default, the post type select field only shows public post types. This
 * can cause problems with native WordPress functionality, like the post type
 * filter button on top of the post list screen, that (for some reason) causes 
 * all posts in the list to save to the post type, that is currently selected.
 * Thus, if the actual post type is hidden, it switches all posts to anther post
 * type, probably 'post', since it usually is the first in the list.
 */
function filter_pts_post_type_filter( $array ) {
 
  // Enable all available post types by removing the default restrictions.
  $array = array();
  return $array; 
};

If too many drop downs are appearing in the quick edit area, from about line 145 change the function to this:

/**
 * Adds quickedit button for bulk-editing post types
 *
 * @since PostTypeSwitcher (1.2)
 */
public function quickedit( $column_name, $post_type ) {
  switch( $column_name ) {
    case 'post_type' :
?>
  <fieldset class="inline-edit-col-right">
    <div class="inline-edit-col">
      <label class="alignleft">
        <span class="title"><?php _e( 'Post Type' ); ?></span>
        <?php wp_nonce_field( 'post-type-selector', 'pts-nonce-select' ); ?>
        <?php $this->select_box(); ?>
      </label>
    </div>
  </fieldset>
<?php
  break;
  }
}

Conflicts

  • Admin Columns plugin (2018-07-11):  Prevents Post Type Switcher’s bulk editing fieldset from showing up in the quick editing section of a post, making it impossible to bulk edit anything.
  • ACF Pro: Removes images from media library if image field is used.
  • Woocommerce Tab Manager

Datum: 2018-10-29
Rubrik: Developer Notes

Über den Autor

Stefan Buchberger beschäftigt sich seit vielen Jahren mit der Präsentation, Verbreitung und Kommunikation von Inhalten. Er war vor allem als Buchverleger aktiv.

Heute gilt seine Aufmerksamkeit einer nachhaltigeren Form der Webentwicklung, welche die Inhalte zurück in den Fokus rückt.

Seitenleiste

Neue Beiträge

Mann skizziert Projekt auf Tafel

Wege zur Website: Nach Maß und von der Stange

Websites entstehen individuell und nach Maß oder auf Basis bestehender Vorlagen. Vielfach aber: sowohl als …
Rhinozeros

Antworten zur Website-Wartung und Wartungsvereinbarung

In diesem Beitrag beantworten wir Fragen, die uns zum Thema Wartung und Wartungsvereinbarung gestellt wurden …
Screenshot

Blog für die Österreichische Gesellschaft für Literatur

Die Österreichische Gesellschaft für Literatur in der Wiener Herrengasse ist Drehscheibe zwischen Texten, Schreibenden und …
Wireframing auf einem Tablet

Projektablauf: Vom Erstgespräch zur fertigen Website

Bevor Sie sich entschließen, mir mehr über Ihr Vorhaben zu erzählen, möchte ich Ihnen die …

WordPress: Infos zu Warnhinweisen und Fehlermeldungen

The installed version of UpdraftPlus Backup/Restore has not been tested on your version of WordPress …

Newsletter

Unser Newsletter mit Tipps und Angeboten erscheint wenige Male im Jahr. Infos zu Versand und Verarbeitung erhalten Sie in unserer Datenschutzerklärung.

    nav-social-menu

    • Facebook
    • Twitter
    • LinkedIn
    • RSS
  • Impressum
  • Datenschutz
Top ▲
Top ▲
Finde

Zeige alle ...

Generic filters
Durch die Nutzung dieser Website erklären Sie sich mit der Verwendung von Cookies einverstanden. Weiters möchten wir Sie auf unsere Datenschutzinformation aufmerksam machen: Erfahren Sie mehr