Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. // Replace your Title Column with the Existing one //
  2. function replace_title_column($columns) {
  3.  
  4. $new = array();
  5.  
  6. foreach($columns as $key => $title) {
  7. if ($key=='title')
  8. $new['new-title'] = __(Title); // Our New Colomn Name
  9. $new[$key] = $title;
  10. }
  11.  
  12. unset($new['title']);
  13. return $new;
  14. }
  15.  
  16. // Replace the title with your custom title
  17. function replace_title_products($column_name, $post_ID) {
  18. if ($column_name == 'new-title') {
  19. $cont = get_the_title();
  20. $cont = str_replace('<', '<', $cont);
  21. $cont = str_replace('>', '>', $cont);
  22. $cont = str_replace('"', '"', $cont); ?>
  23. <a class="row-title" href="<?php echo esc_url( home_url( '/' ) ); ?>wp-admin/post.php?post=<?php echo $post_ID; ?>&action=edit"><?php echo strip_tags($cont); ?></a>
  24. <?php
  25. }
  26. }
  27.  
  28. add_filter('manage_posts_columns', 'replace_title_column');
  29. add_action('manage_posts_custom_column', 'replace_title_products', 10, 2);
  30. add_filter('manage_pages_columns', 'replace_title_column');
  31. add_action('manage_pages_custom_column', 'replace_title_products', 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement