Advertisement
srikat

Untitled

Jun 1st, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. // Register single-optin widget area
  2. genesis_register_widget_area(
  3. array(
  4. 'id' => 'single-optin',
  5. 'name' => __( 'Single Optin', 'my-theme-text-domain' ),
  6. 'description' => __( 'For email option subscription widget', 'my-theme-text-domain' ),
  7. )
  8. );
  9.  
  10. // Display single-optin widget area on single blog posts other than those categorized under "category-2"
  11. add_action( 'genesis_after_header', 'sk_single_optin' );
  12. function sk_single_optin() {
  13.  
  14. // if we are not a single post page, abort.
  15. if ( !is_singular( 'post' ) ) {
  16. return;
  17. }
  18.  
  19. // if the current post is not in "category-2" (slug), abort.
  20. if ( !in_category( 'category-2' ) ) {
  21. return;
  22. }
  23.  
  24. genesis_widget_area( 'single-optin', array(
  25. 'before' => '<div class="single-optin widget-area"><div class="wrap">',
  26. 'after' => '</div></div>',
  27. ) );
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement