Month: January 2018

Search Engine Optimization San Diego

Use PHP in Widgets Without a Plugin WordPress

There are times when you are working on your WordPress website and you might want to execute some php in a widget or sidebar. You can download plugins to do this but this adds bloat to your WordPress. Remember, using the least amount of plugins in your website will ensure that the site loads quickly, has limited conflicts with other plugins and is easy and quick to upgrade.

I always recommend that you do not edit your main themes’ functions.php file, rather, place a new functions.php file in a child-theme folder instead.  This way any updates to WordPress will not break your code.

wp-content/themes/your-theme-here/functions.php  (don’t touch this)

Create a new folder here:

wp-content/themes/your-theme-here-child/

  • notice I added -child  to the end of the new folder

so now you should have

wp-content/themes/your-theme-here/functions.php
wp-content/themes/your-theme-here-child/

Create a NEW functions.php file (use a text editor or notepad) and place it in this folder so it looks like this…

wp-content/themes/your-theme-here-child/functions.php

add this little bit of code to your theme’s function.php file:

// Enable PHP in widgets
add_filter('widget_text','execute_php',100);
function execute_php($html){
     if(strpos($html,"<"."?php")!==false){
          ob_start();
          eval("?".">".$html);
          $html=ob_get_contents();
          ob_end_clean();
     }
     return $html;
}

Next…

Open your WordPress Admin –> APPEARANCE —>  WIDGETS  and add whatever  php code you want to the Widget. Select a TEXT WIDGET and drag it to the SIDEBAR Widget then add your shortcode

or whatever shortcode you have.

**Hint: Remember to us <?php my code here ?> within the widget not just the code itself.

Save it. Then go to your public facing page and you should see the code working!

FIN!

Of course, before making any changes, you should make a full backup of your website. If you don’t want to make a backup from your hosts control panel, you can add a plugin like UpDraft to WordPress to do this for you.

Of course, if you don’t want to do this, you can always hire us!

by James Byrne, Information Architect – After Dark Grafx

Wordpress Developer in San Diego

Use Shortcodes in Widgets Without a Plugin for WordPress

Have ever wanted to use a Shortcode in a widget area of WordPress but didn’t want to add another plugin or contact a developer?

By default, WordPress doesn’t support this feature.

You can simply add this short snippet to your theme’s function.php file and you’ll be using shortcodes in widgets in no time at all!

I always recommend that you do not edit your main themes’ functions.php file, rather, place a new functions.php file in a child-theme folder instead.  This way any updates to WordPress will not break your code.

wp-content/themes/your-theme-here/functions.php  (don’t touch this)

Create a new folder here:

wp-content/themes/your-theme-here-child/

  • notice I added -child  to the end of the new folder

so now you should have

wp-content/themes/your-theme-here/functions.php
wp-content/themes/your-theme-here-child/

Create a NEW functions.php file (use a text editor or notepad) and place it in this folder so it looks like this…

wp-content/themes/your-theme-here-child/functions.php

add this to the functions.php file

<?php 
// Enable shortcodes in widgets
add_filter( 'widget_text', 'shortcode_unautop' );
add_filter('widget_text', 'do_shortcode');
?>

Next…

Open your WordPress Admin –> APPEARANCE —>  WIDGETS  and add whatever Shortcode you want to the Widget. Select a TEXT WIDGET and drag it to the SIDEBAR Widget then add your shortcode

or whatever shortcode you have.

Save it. Then go to your public facing page and you should see the shortcode working!

FIN!

Of course, before making any changes, you should make a full backup of your website. If you don’t want to make a backup from your hosts control panel, you can add a plugin like UpDraft to WordPress to do this for you.

by James Byrne, Information Architect – After Dark Grafx

Miva Developer San Diego

Reusing The What’s Popular Carousel Miva ReadyTheme

So for anyone having this issue… (and assuming that you have already have copied over the template from the best sellers)

HOW TO:
a) locate the folder in your mm5 or miva public folder called js (this where my scripts are installed)
b) find the file called scripts.js (make a backup of course)
c) edit that file with a text editor. and do a find for this string

// —- Product Carousel —- //
cornerstoneUX.sharedFunctions.productsCarousels(‘# js-whats-popular-carousel’);
it will look like this…

jsSFNT: function () {
// —- Product Carousel —- //
cornerstoneUX.sharedFunctions.productsCarousels(‘# js-whats-popular-carousel’);

},

I have FEATURED PRODUCTS and NEW ARRIVALS product sliders on my homepage.

so I added this and change the ID # to your ID in your product listing file in the them (see below)

jsSFNT: function () {
// —- Product Carousel —- //
cornerstoneUX.sharedFunctions.productsCarousels(‘#js-whats-popular-carousel’);
cornerstoneUX.sharedFunctions.productsCarousels(‘#js-featured-carousel‘);
cornerstoneUX.sharedFunctions.productsCarousels(‘#js-new-arrivals-carousel‘);

},

d) Save the file and upload it back to the server /mm5/js/scripts.js

e) Next Login to Miva Admin
f) Click on the MENU top left
h) Then select the ARROW to the right of UTILITIES
i) Your theme comes up –> select PRODUCT LISTINGS
j) 4th line of code down look for this

<div id=”js-whats-popular-carousel” class=”column whole float-none whats-popular-carousel”>

and change it to

<div id=”js-featured-carousel” class=”column whole float-none featured-carousel“>

notice by bolded entries above are the same referenced names as the code placed in the scripts.js file above. If not the same this won’t work. the ID=”js-features-carousel” is the most important. The second one featured-carousel is for specific css styling.

k) Save the setting – then refresh your homepage and your sliders should work.

Just though it would be nice to put a how to! Of course you could just hire us 🙂

Search Engine Optimization San Diego

Make Miva Homepage on iiS Windows Server for web.config

Simply add this to web.config file:

<rule name=”rule 1v” stopProcessing=”true”>
<match url=”^/*$” />
<action type=”Rewrite” url=”//mm5/merchant.mvc” />
</rule>

Adding this code to the web.config file if I now go to http://www.MYDOMAIN.com it will load the miva homepage without redirecting.

Hybrid App Developer

Backup Your Website Today!

Backup your website before it is too late…

You get excited and create a new company website. It looks awesome and has all of the bells and whistles. The company that created your website hopefully gave you a full backup of your website, all files and graphics and the database (if any).

No? Well, most hosting and design companies will offer an online backup resource for you to easily backup your website and files, including all graphics and the database.

How important is your website?

What if your website went down and you do not have a backup or the hosting company could not restore an old backup?

You should get into the habit of downloading these to a local computer, google drive, dropbox or other online service where you can maintain a current monthly (and for the paranoid – daily) backup of your website and files.

If you do not have a current backup of your website, you should login and create one now. Don’t expect your hosting or design company to have the latest backup. It is ultimately up to you, unless you have a support agreement that states they will maintain this for you.

After Dark Grafx offers a free backup service for your website that can be automated so that you can “set it and forget it”.

Contact Us Today if you are interested in finding out more.  Don’t wait until it is too late. BACKUP TODAY!