Posts

Showing posts from 2014

Move Wordpress Site to New URL and Web Host

Moving a website and changing your domain name or URLs (i.e. from http://example.com/site to http://example.com , or http://example.com to http://example.net ) requires the following steps - in sequence. Download your existing site files. Export your database - go in to MySQL and export the database. Move the backed up files and database into a new folder - somewhere safe - this is your site backup. Log in to the site you want to move and go to Settings -> General, then change the URLs. (ie from http://example.com/ to http://example.net ) - save the settings and expect to see a 404 page . Download your site files again. Export the database again. Edit wp-config.php with the new server's MySQL database name, user and password. Upload the files. Import the database on the new server. When your domain name or URLs change there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the datab

How To Write your Own Wordpress Plugin

Create your own PHP script usng the following template: <?php /* Plugin Name: Your Own Plugin Name Description: What your plugin does Version: 0.1 License: GPL Author: Brendan Cornelius Author URI: http://br3nd4nc.blogspot.com */ ?> You can add your own PHP code in this file and upload to the "plugins" folder on your server via FTP Once you upload your file go to your plugins section in your Wordpress Dashboard and activate the plugin

How to Add your own shortcode in Wordpress

In your "functions.php" file in your child theme folder create a function and use the following code to initiate the short code add_shortcode('credits', 'show_website_credits'); The first variable above is the shortcode itself ( in this case [credits]) and the second variable is the name of the function. In total it will look like this function show_website_credits() {   return "Website developed by Brendan."; } add_shortcode('credits', 'show_website_credits');

Add cc email address to Contact Form 7 in Wordpress

Simply add this line under the "Additional Settings" field in your Contact Form 7 settings Cc:you@yourdomain.com

Hide Admin Menu Items from Specific Users in Wordpress

If you develop a site for a client add this function to your themes functions.php file and change the user ID (in the example below it's 3) to the ID of the user you want to hide certain admin menu items. You can get the user's ID by hovering over the users name and looking for "user_id=3" in the bottom left corner of your browser or click on the user name and check the ID in the URL In the function below I've added all the admin page names for reference but commented out // the pages I want the user to see. function remove_menus(){   $user_ID = get_current_user_id();      if ($user_ID == '3') {      //remove_menu_page( 'index.php' );                  //Dashboard   remove_menu_page( 'edit.php' );                   //Posts   //remove_menu_page( 'upload.php' );                 //Media   //remove_menu_page( 'edit.php?post_type=page' );    //Pages   remove_menu_page( 'edit-comments.php' );          //Comm

Wordpress Contact Form 7 manually add Aweber subscribers in PHP

Add this function to the Contact Form 7 functions.php file in the /wp-content/plugins/contact-form-7/includes folder. Works with Contact Form 7 v3.9 upwards Change the details to your Aweber list name, meta ad tracking, form id etc. The redirect and redirect_onlist doesn't actually go the page specified (can be removed if you like) Note: the user still has to confirm the subscription via email to be successfully added to the Aweber list function process_aweber($cf7) { $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $name = $_POST['your-name']; $email = $_POST['your-email']; $str= 'meta_web_form_id='.urlencode('000000000'). '&meta_split_id='.urlencode(''). '&meta_redirect_onlist='.urlencode('http://www.yourdomain.co.za'). '&meta_tooltip='.urlencode(''). '&listname='.urlencode('yourListIDhere'). 

Get Contact Form 7 Posted Data in PHP - Updated for v3.9

Use this function...added to your Wordpress theme's functions.php file This PHP function is run before the form sends an email.  You can use this to store the form data in a database or post to another system. The old $cf7->posted_data['your-email'] doesn't collect the form posted data in the new version of Wordpress Contact Form 7 v3.9+ function something_before_sending_email($cf7) { $submission = WPCF7_Submission::get_instance(); if ( $submission ) { $name = $_POST['your-name']; $email = $_POST['your-email']; } } add_action('wpcf7_before_send_mail',something_before_sending_email'); Thanks to Paulo's post here: http://getlostandwander.blogspot.com/2014/07/contact-form-7-new-way-to-save-data.html

Make Wordpress Twenty Thirteen Header 100% iPad compatible

In your style.css file search for @media (max-width: 767px) { and change the max-width to 768px like this: @media (max-width: 768px) { Add this CSS code within this media brace .site-header { position: relative; background-size: 100% 82% !important; } The 100% is for the width of the header and the 82% is for the height. Adjust these percentages to suit your template design and test on the iPad

Wordpress Add Pagination to Pages the Simple and Easy way

To add the built-in Wordpress pagination to your page with a lot of content simple add this line in "Text" mode at the places where you wish to break the page into multiple pages. <!--nextpage--> In my experience it took about 10 minutes for Wordpress to register I was using this feature and display the pagination on my page.  If you don't see the pagination immediately then wait a while. Tested in Wordpress 3.9.+

New South African Digital artist Digital Colonel very impressive

Came across this new South African digital musician called Digital Colonel on Soundcloud and his tracks are very impressive. Take a listen to his dance track and my personal favourite below.

Buy House Music Samples

Buy top quality South African House Samples from as little as R50 Go here to purchase samples Listen to a snippet below

Disable Home Title in Wordpress

Replace <?php the_title(); ?> with <?php if ( ! is_front_page() ) { the_title(); } ?> in page.php to not show title on home page if you want

Best breadcrumb plugin for Wordpress - tried and tested

This breadcrumb Wordpress plugin is very simple to install and use and it has been tried and tested on all my Wordpress instrallations In your Wordpress admin backend search for "Really Simple Breadcrumb" Download and Install the plugin Add the code below to page.php <?php if(function_exists(simple_breadcrumb) && !is_front_page()) {simple_breadcrumb();} ?> NB: The PHP code above will show the breadcrumb on all pages except the homepage Add .breadcrumb { } to your CSS stylesheet Edit CSS breadcrumb class accordingly

Contact Form 7 Wordpress Plugin Redirect to another page after submission

With the Contact Form 7 plugin in Wordpress this is how I redirected to another page with my Google Conversion Tracking code in place Redirect to unique thank you page with conversion tracking Add this to the "additional settings" section for Contact Form 7: on_sent_ok: "location.replace('http://www.YOURSITEURL.com');"

Secure Wordpress site with use of htaccess rules

To secure my Wordpress sites from SQL injection and folder browsing I've used these htaccess rules after installing Wordpress. These htaccess rules do not break your Wordpress site or interfere with the database in any way. Use these htaccess rules to secure your Wordpress site from attack in addition to your other security plugins and measures. # Enable rewrite engine RewriteEngine On # Prevent folder browsing Options All -Indexes # Disable server signature ServerSignature Off # Block suspicious request methods RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK|DEBUG) [NC] RewriteRule ^(.*)$ - [F,L] # Block WP timthumb hack RewriteCond %{REQUEST_URI} (timthumb\.php|phpthumb\.php|thumb\.php|thumbs\.php) [NC] RewriteRule . - [S=1] # Block suspicious user agents and requests RewriteCond %{HTTP_USER_AGENT} (libwww-perl|wget|python|nikto|curl|scan|java|winhttp|clshttp|loader) [NC,OR] RewriteCond %{HTTP_USER_AGENT} (<|>|'|%0A|%0D|%27|%3C|%3E|) [N

Contact Form 7 Additional Tags

I found these additional tags for the Contact Form 7 plugin for Wordpress.   I found it helpful when customising my subject line to include the date and time and the post title to Contact Form 7 email to track effective pages with the contact form. [_remote_ip] This tag will be replaced by the sender’s client IP address. [_user_agent] This tag will be replaced by the sender’s user agent information. [_url] This tag will be replaced by the URL of the contact form. [_date] This tag will be replaced by the date of the submission. [_time] This tag will be replaced by the time of the submission. [_post_id] This tag will be replaced by the ID of the post which contains the contact form. [_post_name] This tag will be replaced by the name (slug) of the post which contains the contact form. [_post_title] This tag will be replaced by the title of the post which contains the contact form. [_post_url] This tag will be replaced by the permalink of the post whic