Plugin Directory

Changeset 3466097


Ignore:
Timestamp:
02/20/2026 09:06:19 PM (3 days ago)
Author:
a1tools
Message:

v1.4.14: Add [a1tools_website_url] shortcode

Location:
a1-tools/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • a1-tools/trunk/a1-tools.php

    r3465976 r3466097  
    44 * Plugin URI:        https://tools.a-1chimney.com
    55 * Description:       Connects your WordPress site to the A1 Tools platform for centralized management of contact information, social media links, and business details.
    6  * Version:           1.4.13
     6 * Version:           1.4.14
    77 * Requires at least: 5.0
    88 * Requires PHP:      7.4
     
    2121
    2222// Plugin constants.
    23 define( 'A1TOOLS_VERSION', '1.4.13' );
     23define( 'A1TOOLS_VERSION', '1.4.14' );
    2424define( 'A1TOOLS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    2525define( 'A1TOOLS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     
    134134 * or href="mailto:[a1tools_var ...]" and resolves them before normal rendering.
    135135 *
    136  * @since 1.4.13
     136 * @since 1.4.14
    137137 * @param string $content Post content.
    138138 * @return string Content with shortcodes resolved inside attributes.
     
    204204
    205205/**
     206 * Shortcode: [a1tools_website_url]
     207 * Outputs the website URL as text or a clickable link.
     208 *
     209 * @since 1.4.14
     210 * @param array $atts Shortcode attributes.
     211 * @return string Shortcode output.
     212 */
     213function a1tools_shortcode_website_url( $atts ) {
     214    $atts = shortcode_atts(
     215        array(
     216            'link'   => 'false',
     217            'target' => '_blank',
     218            'class'  => '',
     219            'text'   => '',
     220        ),
     221        $atts,
     222        'a1tools_website_url'
     223    );
     224
     225    $url = home_url( '/' );
     226
     227    // If link="true", output as a clickable link.
     228    if ( 'true' === $atts['link'] ) {
     229        $link_text  = ! empty( $atts['text'] ) ? esc_html( $atts['text'] ) : esc_html( $url );
     230        $class_attr = ! empty( $atts['class'] ) ? ' class="' . esc_attr( $atts['class'] ) . '"' : '';
     231        $rel_attr   = '_blank' === $atts['target'] ? ' rel="noopener noreferrer"' : '';
     232        return '<a href="' . esc_url( $url ) . '" target="' . esc_attr( $atts['target'] ) . '"' . $rel_attr . $class_attr . '>' . $link_text . '</a>';
     233    }
     234
     235    // Plain text output.
     236    if ( ! empty( $atts['class'] ) ) {
     237        return '<span class="' . esc_attr( $atts['class'] ) . '">' . esc_html( $url ) . '</span>';
     238    }
     239
     240    return esc_html( $url );
     241}
     242add_shortcode( 'a1tools_website_url', 'a1tools_shortcode_website_url' );
     243
     244/**
    206245 * Shortcode: [a1tools_address format="full"]
    207246 * Outputs formatted address.
     
    410449 * Get SVG markup for icons not available in Font Awesome 5.
    411450 *
    412  * @since 1.4.13
     451 * @since 1.4.14
    413452 * @param string $icon_key The SVG icon key (e.g. 'svg-x').
    414453 * @return string SVG markup or empty string.
     
    424463 * Get icon HTML (SVG or Font Awesome <i> tag).
    425464 *
    426  * @since 1.4.13
     465 * @since 1.4.14
    427466 * @param string $icon Icon class or SVG key.
    428467 * @return string HTML markup for the icon.
  • a1-tools/trunk/readme.txt

    r3465976 r3466097  
    44Requires at least: 5.0
    55Tested up to: 6.9
    6 Stable tag: 1.4.13
     6Stable tag: 1.4.14
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    151151
    152152== Changelog ==
     153
     154= 1.4.14 =
     155* Added [a1tools_website_url] shortcode to display the site URL
     156* Supports link="true" for clickable links and text="" for custom link text
    153157
    154158= 1.4.13 =
Note: See TracChangeset for help on using the changeset viewer.