Guest User

Untitled

a guest
Sep 2nd, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. add_filter( 'pre_handle_404', function($param1, $param2) {
  2.  
  3. $post_id = url_to_postid("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
  4. if (!empty($post_id)) {
  5.  
  6. $td_post_theme_settings = td_util::get_post_meta_array( $post_id, 'td_post_theme_settings' );
  7. // standard smartlist
  8. if ( is_array( $td_post_theme_settings ) && array_key_exists( 'smart_list_template', $td_post_theme_settings ) ) {
  9. return true;
  10. } elseif ( !empty ($td_post_theme_settings['td_post_template']) && td_global::is_tdb_registered() && td_global::is_tdb_template($td_post_theme_settings['td_post_template'], true) ) { // cloud template smartlist
  11. $td_template_id = td_global::tdb_get_template_id($td_post_theme_settings['td_post_template']);
  12. $td_template_content = get_post_field('post_content', $td_template_id);
  13. $is_tdb_smartlist = tdb_util::get_shortcode($td_template_content, 'tdb_single_smartlist');
  14.  
  15. if ( $is_tdb_smartlist ) {
  16. return true;
  17. }
  18. }
  19. }
  20. return $param1;
  21. }, 10, 2);
Add Comment
Please, Sign In to add comment