Skip to content

Instantly share code, notes, and snippets.

@infn8
Last active April 5, 2018 11:11
Show Gist options
  • Select an option

  • Save infn8/43f8f94437637453f6a5 to your computer and use it in GitHub Desktop.

Select an option

Save infn8/43f8f94437637453f6a5 to your computer and use it in GitHub Desktop.

Revisions

  1. infn8 revised this gist Mar 4, 2015. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # Instructions

    Add the code above to your theme's ```functions.php``` file.

    Alter the size of ```$containerLG``` if you have changed the BS 3 grid. you can then call the images in you themes like so:

    ```
    <?php
    the_post_thumbnail( 'col-lg-3');
    ?>
    ```
    That will call an image that's maxed at a width of 1/4 of the full container width.
  2. infn8 created this gist Mar 4, 2015.
    14 changes: 14 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    function add_theme_features() {
    // Add Image Sizes
    $containerLG = 1170; // Change this if you have updated the largest bootstrap container width.
    for ($i=1; $i <= 12; $i++) {
    add_image_size(
    'col-lg-'.$i,
    ceil($containerLG / 12 * $i),
    ceil($containerLG / 12 * $i) * 10,
    false
    );
    }
    }
    // Hook into the 'after_setup_theme' action
    add_action( 'after_setup_theme', 'add_theme_features' );