Category: News

Display the module position

Use the following code to display the module position <jdoc:include type=”modules” name=”left” style=”xhtml” /> Specify the position “left” “right” etc to display the position

Read More

Use code to verify featured pages

<? if(JRequest::getVar(‘view’) == “featured”) { ?>   Code to be displayed only on featued page which is also home page <? } ?>

Read More

Branch on ‘Origin/master’ has diverged from local branch

if you have revered a commit and want the remote branch to reflect your revert + latest commits use this bit of code git push -f origin master Note that this will reset your remote (origin) master to reflect changes in your local master. Use with caution!

Read More

WordPress Dash incons

Can be used with your custom post types Link reference: Dashicons

Read More

How to transfer email accounts and messages between cPanel servers?

Go to etc/ sub folder Download your site domain file Re-upload the your site domain folder to your new server under etc/ Go to the mail/ sub folder Download your site domain file Re-upload the your site domain file to your new server under mail/ All messages and accounts should now appear…

Read More

Updating Host file on a Mac

If you would like a web address to just point to your local development environment. You will need to edit your local host file. Go to the file and open using a text editor Macintosh HD/private/etc/host Add the iP of your machine followed by the required local address 101.1.1.33 sky-zilla.dev…

Read More

Function Reference/get permalink

Use this to add a permalink to the post. <?php echo get_permalink(); ?>

Read More

Get featured image thumbnail as image or URL

the following code will return a featured image with <img> tags in a medium size. the_post_thumbnail(‘medium’); the following code will give you the URL of the featured image thumbnail (small) only. $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); if you want to get the medium size thumbnail using the same code use:…

Read More

explode()

Explode is used to separate a string of text or values that are differentiated by a marker such as a space or a symbol. example: $pizza  =  “piece1 piece2 piece3 piece4 piece5 piece6″; $pieces =  explode(” “, $pizza); echo $pieces[0]; // piece1 echo $pieces[1]; // piece2  

Read More

Trim text using wp_trim_words( )

User the following to trim display text. The following example is using a text field. wp_trim_words( get_field(‘intro_text’), 20 );

Read More
© Toffy digital 2016 Powered by Toffy Digital