Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wordpress shortcode

Featured Replies

Yo , as I been checking the forum since yesterday I saw only questions so I thought I explain a bit about wordpress customization :

 

In the example below I have used the short code [go] (square brackets are always included as part of a WordPress shortcode) to enter a linked button that could, for example, be used as a link on multiple pages throughout the site.

 

[realgo]

 

The advantages in this case are in:

 

* speed

* ease-of-use

* consistency

 

You can be assured that the button & link will be consistent whenever the short code is used and the process will be altogether more efficient (provided you remember the short code!).

 

To set up this short code the following lines were added to functions.php in the theme folder:

 

    function add_go_button() {
   return ‘<a href=”http://www.junowebdesign.com/contact”><img src=”http://www.junowebdesign.com/wp-content/themes/juno/images/go-button.png” alt=”go” /></a>’;
   }
   add_shortcode(‘go’, ‘add_go_button’);

 

The parameters used by add_shortcode() are firstly the short code (here ‘go’ corresponding to ‘[go]‘ when entering post/page content) and secondly the function that you want to be called when the short code is processed.

Using add_shortcode() To Format Content Easily

 

The next example shows how short codes can be wrapped around content, in this case to format a section of text. The content in the admin section is input as:

 

[box]This content is wrapped in a fancy box.[/box]

This content is then processed to appear as:

[realbox]This content is wrapped in a fancy box.[/realbox]

 

A key advantage here is that the theme can be set up to allow an editor who is unfamiliar with XHTML & CSS enhanced options for formatting their content – and this is all possible while remaining in ‘Visual’ (rather than ‘HTML’) mode in the admin.

 

The code added to functions.php to enable this short code is:

 

    function fancy_box( $atts, $content = null ) {
   return ‘<div class=”fancy”>’ . $content . ‘</div>’;
   }
   add_shortcode(‘box’, ‘fancy_box’);

This post only begins to look at the options available using the WordPress Shortcode API. This functionality can be extended with attributes and nested short codes.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.