Genesis Title Toggle on Custom Post Types – Learn Dash

By default Genesis Title Toggle only works on pages, but you can enable it for regular posts and custom post types by using a filter that the plugin comes with – in the example below I need it enabled for the default custom post types that come with Learn Dash.

<?php
/**
* Add Genesis Title Toggle to Custom Post Types using Learn Dash as an example
*
* @link http://www.billerickson.net/code/genesis-title-toggle-for-posts
* @link https://wpbeaches.com/genesis-title-toggle-custom-post-types-learn-dash/
* @author Bill Erickson
* @author neilgee
*
* @param array $post_types
* @return array
*/
function themeprefix_title_toggle_on_cpts( $post_types ) {
$post_types[] = array('posts','sfwd-courses','sfwd-lessons','sfwd-quiz','sfwd-certificates'); //add your CPTs
return $post_types;
}
add_filter( 'be_title_toggle_post_types', 'themeprefix_title_toggle_on_cpts' );
view raw title-toggle.php hosted with ❤ by GitHub

So in the snippet above Genesis Title Toggle is now enabled for  regular posts and the CPTs for Learn Dash:

  • sfwd-courses
  • sfwd-lessons
  • sfwd-quiz
  • sfwd-certificates

For any other CPTs just add the names to the array.

 

Leave a Comment





%d bloggers like this: