Skip to content

Instantly share code, notes, and snippets.

@svebal
Last active October 10, 2017 11:51
Show Gist options
  • Select an option

  • Save svebal/32f08ca07b737a76e224e107466d983f to your computer and use it in GitHub Desktop.

Select an option

Save svebal/32f08ca07b737a76e224e107466d983f to your computer and use it in GitHub Desktop.

Revisions

  1. svebal revised this gist Oct 10, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions svebal_custom_css_class.php
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    <?php
    /**
    to body of one page
    https://developer.wordpress.org/reference/functions/body_class/
    * to body of one page
    * https://developer.wordpress.org/reference/functions/body_class/
    **/
    function svebal_custom_body_class_v1( $classes ) {
    if ( is_page( 'page-1' ) ) {
    @@ -23,8 +23,8 @@ function svebal_custom_body_class_v2( $classes ) {
    add_filter( 'body_class', 'svebal_custom_body_class_v2' );

    /**
    to a post
    https://developer.wordpress.org/reference/functions/post_class/
    * to a post
    * https://developer.wordpress.org/reference/functions/post_class/
    **/
    function svebal_custom_post_class( $classes ) {
    if( is_page( 'page-1' ) ) {
  2. svebal revised this gist Oct 10, 2017. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions svebal_custom_css_class.php
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    <?php
    /** to body of one page **/
    /**
    to body of one page
    https://developer.wordpress.org/reference/functions/body_class/
    **/
    function svebal_custom_body_class_v1( $classes ) {
    if ( is_page( 'page-1' ) ) {
    $classes[] = 'own-class';
    @@ -19,7 +22,10 @@ function svebal_custom_body_class_v2( $classes ) {
    }
    add_filter( 'body_class', 'svebal_custom_body_class_v2' );

    /** to a post **/
    /**
    to a post
    https://developer.wordpress.org/reference/functions/post_class/
    **/
    function svebal_custom_post_class( $classes ) {
    if( is_page( 'page-1' ) ) {
    $classes[] = 'own-class';
  3. svebal revised this gist Oct 10, 2017. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions svebal_custom_css_class.php
    Original file line number Diff line number Diff line change
    @@ -5,26 +5,26 @@ function svebal_custom_body_class_v1( $classes ) {
    $classes[] = 'own-class';
    }

    return $classes;
    return $classes;
    }
    add_filter( 'body_class', 'svebal_custom_body_class_v1' );

    /** to body of more pages **/
    function svebal_custom_body_class_v2( $classes ) {
    if( is_page( array( 'page-1', 'page-2', 'page-2' ) ) ) {
    $classes[] = 'own-class';
    }
    if( is_page( array( 'page-1', 'page-2', 'page-2' ) ) ) {
    $classes[] = 'own-class';
    }

    return $classes;
    return $classes;
    }
    add_filter( 'body_class', 'svebal_custom_body_class_v2' );

    /** to a post **/
    function svebal_custom_post_class( $classes ) {
    if( is_page( 'page-1' ) ) {
    $classes[] = 'own-class';
    }
    return $classes;
    if( is_page( 'page-1' ) ) {
    $classes[] = 'own-class';
    }
    return $classes;
    }
    add_filter( 'post_class', 'svebal_custom_post_class' );
    ?>
  4. svebal revised this gist Oct 10, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions svebal_custom_css_class.php
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    <?php
    /** to body of one page **/
    function svebal_custom_body_class_v1( $classes ) {
    if ( is_page( 'page-1' ) ) {
    $classes[] = 'own-class';
    }
    if ( is_page( 'page-1' ) ) {
    $classes[] = 'own-class';
    }

    return $classes;
    }
  5. svebal revised this gist Oct 10, 2017. No changes.
  6. svebal revised this gist Oct 10, 2017. No changes.
  7. svebal revised this gist Oct 10, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion svebal_custom_css_class.php
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ function svebal_custom_body_class_v2( $classes ) {

    return $classes;
    }
    add_filter( 'body_class', 'svebal_custom_body_class_v1' );
    add_filter( 'body_class', 'svebal_custom_body_class_v2' );

    /** to a post **/
    function svebal_custom_post_class( $classes ) {
  8. svebal created this gist Oct 10, 2017.
    30 changes: 30 additions & 0 deletions svebal_custom_css_class.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    <?php
    /** to body of one page **/
    function svebal_custom_body_class_v1( $classes ) {
    if ( is_page( 'page-1' ) ) {
    $classes[] = 'own-class';
    }

    return $classes;
    }
    add_filter( 'body_class', 'svebal_custom_body_class_v1' );

    /** to body of more pages **/
    function svebal_custom_body_class_v2( $classes ) {
    if( is_page( array( 'page-1', 'page-2', 'page-2' ) ) ) {
    $classes[] = 'own-class';
    }

    return $classes;
    }
    add_filter( 'body_class', 'svebal_custom_body_class_v1' );

    /** to a post **/
    function svebal_custom_post_class( $classes ) {
    if( is_page( 'page-1' ) ) {
    $classes[] = 'own-class';
    }
    return $classes;
    }
    add_filter( 'post_class', 'svebal_custom_post_class' );
    ?>