Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <?php
  2. // Add filter to determine if certain posts should excluded
  3. add_filter( 'toplytics_exclude_post', 'check_if_topolytics_should_exclude', 10, 2 );
  4. function check_if_topolytics_should_exclude( $should_exclude, $post_id ) {
  5. $excluded_posts = get_peta_excluded_posts();
  6. if ( in_array( $post_id, $excluded_posts ) ) {
  7. $should_exclude = true;
  8. }
  9.  
  10. return $should_exclude;
  11. }
  12.  
  13.  
  14. function display_my_post() {
  15. // filter checks if post should be excluded
  16. $exclude_post = apply_filters( 'toplytics_exclude_post', false, $post_id );
  17.  
  18. if ( true === $exclude_post ) {
  19. // Post should be excluded - do not process this post
  20. return;
  21. }
  22.  
  23. // Continue displaying post if it's not excluded
  24. // ...
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement