WordPress.org

Ready to get started?Download WordPress

Forums

Post Snippets
[resolved] Sitename (3 posts)

  1. frosy
    Member
    Posted 1 year ago #

    How could I simply add the site name using a shortcode?

    I want to replace the site URL using a shortcode for when my site is cloned onto another domain.

    Any help appreciated.

    http://wordpress.org/extend/plugins/post-snippets/

  2. Covi
    Member
    Posted 1 year ago #

    A few of my snippets:

    uploads_url (Sortcode, PHP code)

    $upload_dir = (array) wp_upload_dir();
    if ( isset($upload_dir['baseurl']) && !empty($upload_dir['baseurl']) )
    	echo $upload_dir['baseurl']; }
    else
    	// your fallback

    home_url (Sortcode, PHP code, vars: path,scheme)

    echo home_url("{path}", "{scheme}");

    ...imagine what you can do ;)

    F.e: you can make a snippet for bloginfo (untested):

    bloginfo (Sortcode, PHP code, vars: key)

    echo bloginfo("{key}");

    or

    bloginfo (Sortcode, PHP code, vars: key,echo)

    if ( "" !== "{echo}" )
    	echo get_bloginfo("{key}");
    else
    	get_bloginfo("{key}");

    I use a lot: antispambot, permalink, google maps, Wikipedia, Google links...
    Great plugin ;)

  3. cristtiah
    Member
    Posted 11 months ago #

    hi am new to coding in php and snippets, if I want to dynamically get my site_url and place it in an image <img src="{site_url}/images/test.jpg" how would I define the snippet? thanks so much

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic