Skip to content

Instantly share code, notes, and snippets.

@dkvadratu
Last active February 8, 2021 07:38
Show Gist options
  • Select an option

  • Save dkvadratu/5a16f281951a14c033318bfe66a47664 to your computer and use it in GitHub Desktop.

Select an option

Save dkvadratu/5a16f281951a14c033318bfe66a47664 to your computer and use it in GitHub Desktop.

Revisions

  1. dkvadratu revised this gist Feb 8, 2021. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
  2. dkvadratu revised this gist Feb 8, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shortcode_with_content.php
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,4 @@ function blocks( $atts, $content = null ) {
    }
    add_shortcode('blocks', 'blocks');

    //usage: [blocks]Inner content to print[/blocks]
    //usage: [blocks border_radius='yes']Inner content to print[/blocks]
  3. dkvadratu revised this gist Feb 8, 2021. 2 changed files with 15 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion shortcode.php
    Original file line number Diff line number Diff line change
    @@ -7,4 +7,6 @@ function bartag_func( $atts ) {

    return "foo = {$a['foo']}";
    }
    add_shortcode( 'bartag', 'bartag_func' );
    add_shortcode( 'bartag', 'bartag_func' );

    //usage: [bartag foo="foo-value"]
    12 changes: 12 additions & 0 deletions shortcode_with_content.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?php
    function blocks( $atts, $content = null ) {
    extract(shortcode_atts(array(
    'border_radius' => 'no',
    'spacing' => 'no'
    ), $atts));

    return '<div class="ef-blocks d-flex flex-column flex-md-row spacing-'.strtolower($spacing).' border-radius-'.strtolower($border_radius).'">'.$content.'</div>';
    }
    add_shortcode('blocks', 'blocks');

    //usage: [blocks]Inner content to print[/blocks]
  4. dkvadratu renamed this gist Feb 8, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. dkvadratu created this gist Feb 8, 2021.
    10 changes: 10 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    <?php
    function bartag_func( $atts ) {
    $a = shortcode_atts( array(
    'foo' => 'something',
    'bar' => 'something else',
    ), $atts );

    return "foo = {$a['foo']}";
    }
    add_shortcode( 'bartag', 'bartag_func' );