Friday 27 December 2013

Joomla Administration; How to add a custom dropdown list to a form

The aim here was to make some customisations to the Messaging component.  I wanted to change the user dropdown to only select from our shoppers.


Here's how I fixed this.

I added this file administrator/com_message/models/fields/ourshoppers.php

getQuery(true);
 
                $query->select('user_id As value, username As text');
                $query->from('#__users AS a');   
    $query->join('LEFT', '#__mijoshop_user AS m ON m.userid = a.id');
                $query->order('a.username');
                $query->where('m.status = 1');
 
                // Get the options.
                $db->setQuery($query);
 
                $options = $db->loadObjectList();
 
                // Check for a database error.
                if ($db->getErrorNum()) {
                        JError::raiseWarning(500, $db->getErrorMsg());
                }
 
                return $options;
        }
}


defined('JPATH_BASE') or die;

jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');

/**
 * Custom Field class for the Joomla Framework.
 *
 * @package             Joomla.Administrator
 * @subpackage          com_my
 * @since               1.6
 */
class JFormFieldOurShoppers extends JFormFieldList
{
        /**
         * The form field type.
         *
         * @var         string
         * @since       1.6
         */
        protected $type = 'OurShoppers';

        /**
         * Method to get the field options.
         *
         * @return      array   The field option objects.
         * @since       1.6
         */
        public function getOptions()
        {
                // Initialize variables.
                $options = array();

                $db     = JFactory::getDbo();
                $query  = $db->getQuery(true);

                $query->select('user_id As value, username As text');
                $query->from('#__users AS a');  
                $query->join('LEFT', '#__mijoshop_user AS m ON m.userid = a.id');
                $query->order('a.username');
                $query->where('m.status = 1');

                // Get the options.
                $db->setQuery($query);

                $options = $db->loadObjectList();

                // Check for a database error.
                if ($db->getErrorNum()) {
                        JError::raiseWarning(500, $db->getErrorMsg());
                }

                return $options;
        }
}




and then in administrator/com_messages/models/forms/message.xml
FIND
name="user_id_to"



And underneath change the type to 'our shoppers'

type="OurShoppers"

type="OurShoppers"






###########################

Here's what I searched for on Google


joomla com_messages model how to effect the recipient dropdown

joomla messages components how to effect the recipient dropdown

joomla changing a input-append in administrator


how to make your own customised forms .  Heres a great article.

http://docs.joomla.org/J2.5:How_to_add_custom_filters_to_components


index.php?

option=com_users&view=users&layout=modal&tmpl=component&field=jform_us

er_id_to&groups=WyI3IiwiOCJd&excluded=WyI4MjIiXQ==

joomla 3 administrator models/fields custom dropdown


I NEED TO LINK UP TO MIJOSHOP CUSTOMER AND NOT MIJOSHOP USER.  !! match on email !!


Here's the answer on this page ->

http://docs.joomla.org/Creating_a_custom_form_field_type

joomla RD Ticketmaster - Change checkout so that the Returning Customer box isn't dropped down

OPEN

components/com_ticketmaster/views/checkout/tmpl/default.php


and comment out the line


JQ('.acc_trigger:first').addClass('active').next().show();

around line 109

Wednesday 11 December 2013

Joomla Ticketmaster Mailchimp not working

In configuration after I save my Mailchimp API returns as a single value and the List ID does the same.

To fix this you need to make this change in MySql

in the table __ticketmaster_config

you need to change both tables  mailchimp_listid  & mailchimp_api from INT to VARCHAR

Monday 9 December 2013

Wordpress Wealthz theme weird behavior of Portfolios

I'd been having a few weird issues when loading Portfolios on to our Wealthz theme. 

What was happing is after a certain amount when I was adding a new item then the oldest Portfolio would not show.   After changing the category layout I was still getting some weird behavior in that the last 2 categories had all the same images. 

The fix here is in the Wealthz theme options - go to

Theme Options, On portfolio options tab, number of portfolios will be a default of 12 . Change this to a much higher number.

Wednesday 4 December 2013

Jigoshop how to add product code to products

what you need to search for is SKU.  and this is set in > Jigoshop > Settings.

the go to 'Products & Inventory'    and tick 'enable SKU field'




Monday 2 December 2013

Joomla RD Media Ticketmaster change Rolling Stones text

on the background of the PDF's of the tickets we're sending out we have a message like 'you're tickets for the Rolling Stones'
To get rid of this you need to change the PDF background .  You can find this at
admin > components > com_ticketmaster > assets > etickets

And you can also upload this on each individual ticket.

Thursday 28 November 2013

Joomla Ticketmaster - Sell promo tickets first

I've made a couple of changes to Joomla Ticketmaster . They're hacks so will need uploading on any future developments of the component.


Firstly the client was after selling tickets at Promotional Price and then once they've run out the full price tickets will sell.

To do this ADD your promo tickets FIRST  .  And the tickets MUST HAVE THE SAME NAME


Here's the hack

OPEN com_ticketmaster/models/eventlist.php  

find



   function getList() {
   
  if (empty($this->_data)) {

    $db = JFactory::getDBO();
   
   $where  = $this->_buildContentWhere();
   $order  = $this->_buildContentOrderBy();
  
   ## Making the query for showing all the clients in list function
   $sql = 'SELECT a.*, b.eventname, b.groupname, v.venue AS venuename, v.id AS venueid
     FROM #__ticketmaster_tickets AS a, #__ticketmaster_events AS b, #__ticketmaster_venues AS v'
     .$where
 .$order;     
   
    $db->setQuery($sql, $this->getState('limitstart'), $this->getState('limit' ));
    $this->data = $db->loadObjectList();
  }
  return $this->data;
 }

AND REPLACE WITH
     function getList() {
   
  if (empty($this->_data)) {

    $db = JFactory::getDBO();
   
   $where  = $this->_buildContentWhere();
   $order  = $this->_buildContentOrderBy();
  
   ## Making the query for showing all the clients in list function
   $sql = 'SELECT a.*, b.eventname, b.groupname, v.venue AS venuename, v.id AS venueid
     FROM #__ticketmaster_tickets AS a, #__ticketmaster_events AS b, #__ticketmaster_venues AS v'
     .$where
 .' AND a.totaltickets > 0 GROUP   BY a.ticketname'   
     .$order;  // changed by littleripples.com      
   
    $db->setQuery($sql, $this->getState('limitstart'), $this->getState('limit' ));
    $this->data = $db->loadObjectList();
  }
  return $this->data;
 }
 
 
 
 
SAVE AND UPLOAD


Wednesday 27 November 2013

Images not showing on Front Page of Wordpress Fashionista Theme

The issue here is that after blogging some images aren't displaying. As pictured here.




These display boxes are set in the Post; of which you can choose which format you wish.  I'm going to make this change in 'standard' but you'll need to spread over to the other formats too.

Take a look at the page wp-content/themes/wpex-fashionista/formats/entry-standard.php

Look for the code

aq_resize( wp_get_attachment_url(get_post_thumbnail_id(),'full'), x, x, false ); 


if you change the False here to True then this will allow cropping :)

Saturday 23 November 2013

Issues purchasing after Upgrade to Joomla 3.2

The first part of this blog acts as a lesson learnt and a big slap on the wrist for myself. When doing any upgrade on Joomla you should always make a full backup; I also always do this in a testing area. The slap on the wrist comes now with the level of testing given at this point - Do not trust the label of 'STABLE upgrade'; it still needs thorough testing through all processes and not just checking all Pages, which is what I done. Ok so let's have a look at the actual issues that occured. user name and password do not match or you do not have an account yet The mail function has been temporarily disabled on this site COM_TICKETMASTER_AUTOLOGIN_LOGIN_FAILURE 1. The Mail Function has been temporarily disabled on this site. this is an easy - switch on switch off solution in admin -> http://forum.joomla.org/viewtopic.php?f=706&t=825521 2. COM_TICKETMASTER_AUTOLOGIN_LOGIN_FAILURE & user name and password do not match or you do not have an account yet Take a look at https://github.com/Skullbock/joomla-cms/commit/dac70c8c023a2cf1079fa8c31fa2ed3dc393f966 you need to make a change to the Joomla core at lugins/user/joomla/joomla.php Also I had noticed I was getting this message in admin Error "Password too long. Please select a password with 55 or fewer characters." to fix this i went to Plugin Manager: System - Remember Me and reduced the value of Key Length to 6. and my issue seems to be fixed.

Tuesday 29 October 2013

wordpress shortcode to make featured image gallery from pages

what I was looking to do here is to have a shortcode that shortcode that shows the featured images of a range of Post or Pages.

One issue I've had to overcome here is that I couldn't get get_the_post_thumbnail to work for me.

Here's the code I've written which you'll need to put in your templates function.php
function page_featured_images_ofparent() {
$postid = get_the_ID();
$children = get_children($postid);

foreach ($children as $child):
// print_r($child);
 //echo "

"; $child_id = $child->ID; $URL = $child->guid; $title = $child->post_title; // echo "Child Id = $child_id
"; if(has_post_thumbnail( $child_id )): $image = wp_get_attachment_image_src( get_post_thumbnail_id( $child_id ), 'thumbnail' ); // 'single-post-thumbnail' $image_url = $image[0]; echo ''; endif; endforeach; return; } add_shortcode ('page-feat-img-childs', 'page_featured_images_ofparent');


and you can use the code
[page-feat-img-childs]

Put this wordpress shortcode on any of your posts or pages and it will show all the featured images of any child post or blogs.

Tuesday 22 October 2013

CSS Fix: ipad phone numbers different color

on the ipad ( and not the screenfly ) phone numbers are recognised and rapped in 'a' tags.  this means in your CSS you need to cover this child class of your current class too.

ie

.phonenumber {
color: #fff;
}

should be

.phonenumber, .phonenumber a {
color: #fff;
}

Wednesday 16 October 2013

Wordpress how to display a different page for mobile

Essential what I'd like to do is to show a different landing page when a user arrives from a mobile device.  The only thing is I can't seem to find a plugin that does just that.  Most mobile plugins are designed to change themes and not just the static page. 

Rather than make the needed plugin what I'm going to do is use some CSS tricks to display the content I want on mobiles and not on larger screens.

So in concept you have something like

@media handheld, only screen and (max-width: 649px)  {
.largecontent { display:none; }
}
@media handheld, only screen and (min-width: 650px)  {
.mobilecontent {display:none;
}

Monday 14 October 2013

6 Very Useful Wordpress plugins to complete a wordpress project.

Please take a look at my Wordpress installation Check list. This blog is written as a follow up to that to suggest some Plugins that I'm using on multiple sites and are becoming essential for some types of website. Some are essential plugins if you're making wordpress website for clients.

Mailchimp for WP Lite - Build yourself a list for sending newsletters.

Jigoshop - Ecommerce solution. There are a heap of these to choose from and some close runners. The thing I like about with Jigoshop is that the logic of code of this plugin seems to make the most sense to me. So it's become my favourite.

WP Help - add help pages to the admin section. This means any help given to clients can just be added to this section. No more looking through emails to find that help that was sent. A must add Plugin for all websites that are not made for your self.

Google Maps v3 Shortcode multiple Markers

My goto plugin to show google maps. Excellent for multiple spots. adding graphics and area shading . Take a look at my blog How to draw multiple circles on your Google Map.

Facebook Comments - let people use their facebook profiles and login to leave comments .

Admin Menu Editor for Wordpress .

Change the look of the Admin menu representation for your users.

Tuesday 8 October 2013

Wordpress themes - adding to a class to identify the home page.

Here's a quick one.

I need to add a classname to my sidebar; so that I could identify if I was on the homepage or not.

take this tag




this would need to change to

  

Friday 4 October 2013

Responsive CSS example for Ipad and Smart Phones

One thing that has kept those of us in Website Development busy over the last few years is to make sure clients websites work in all browser.

One go to tool I've been using is this Website Screenfly - test your website in different sizes.


The following snippet of CSS code is to help you write specific CSS for different sized browser you want to target.  In this example I isolate Ipad ( horizontal ) and smartphones ( horizontal ) for my changes.


@media handheld, only screen and (max-width: 1280px) and (min-width: 650px) {
.tp-bullets {
font-size: 18px !important;
}
}

@media handheld, only screen and (max-width: 649px) and (min-width: 240px) {

 .tp-bullets {
font-size: 15px !important;
padding-left: 15px
}

Wednesday 2 October 2013

How to make changes to the slide in Sommerce theme.

Wordpress theme Sommerce comes with it's own slider which is why the location for making changes in admin to this Slider isn't accessed on the left hand menu; like most other Wordpress slider. Here's where you need to go to make changes to it.

In Wordpress Admin:

* Click on 'Themes' on the left hand side.



* Click on 'Theme Option'



* Click on Sliders


* Scroll down to 'Add/Edit slide' if you want to add or make changes.

Tuesday 1 October 2013

How to add functions in wordpress child theme

One thing when Wordpress - Add a Widget space to a template and add a widget to it.  that I was not sure about when adding the menu is how to do that in a child theme.

There's a fairly clear instruction to this in the functions.php of the 'twentytwelve' theme.  and that is

 * When using a child theme (see http://codex.wordpress.org/Theme_Development and
 * http://codex.wordpress.org/Child_Themes), you can override certain functions
 * (those wrapped in a function_exists() call) by defining them first in your child theme's
 * functions.php file. The child theme's functions.php file is included before the parent
 * theme's file, so the child theme functions would be used.



In the case of a menu item; all you need to do is save a new file as functions.php in your child and add

register_sidebar(array(
    'name' => 'Banner Ads',
    'id' => 'bannerads',
    ));



that's enough.  as you're adding to a function .

Check Add functions to your wordpress child theme for more information. []

Friday 27 September 2013

Hack the bullets for Revolution Slider - Wordpress Plugin.

It was requested by my client that they loved the square bullets but could they have some text for each slide in each button. What follows here is the notes of my hack. A full solution would be to make this read the slide title and have the option as a clickable choice in admin. As pictured here. The nice thing about this is that the bullets are highlighted with slide too. Having said that for the record here's my hack, which adds a class in the plugins JQuery file. And then once each bullet can be individually accessed by CSS . the rest of the hack is done in CSS. I had eight slides in this project but this could be expanded to as many or little as you need.


OPEN wp-content/plugins/rs-plugin/jquery.themepunch.revolution.min.js

SEARCH FOR
r.find(".bullet").each(function(r){var i=e(this);
if(r==n.slideamount-1)i.addClass("last");
UNDERNEATH ADD

if(r==1)i.addClass('second');
if(r==2)i.addClass('third');
if(r==3)i.addClass('fourth');
if(r==4)i.addClass('fifth');
if(r==5)i.addClass('sixth');
if(r==6)i.addClass('seventh');
if(r==7)i.addClass('eighth');


Then in your themes style.css add
.tp-bullets.simplebullets.square-old .bullet.first:after{
content: 'Graphics';

}

.tp-bullets.simplebullets.square-old .bullet.second:after{
content: 'Photography';
}

.tp-bullets.simplebullets.square-old .bullet.third:after{
content: 'Film';
}

.tp-bullets.simplebullets.square-old .bullet.fourth:after{
content: 'Audio';
}

.tp-bullets.simplebullets.square-old .bullet.fifth:after{
content: 'PR';
}

.tp-bullets.simplebullets.square-old .bullet.sixth:after{
content: 'Events';
}

.tp-bullets.simplebullets.square-old .bullet.seventh:after{
content: 'Advertising';
}

.tp-bullets.simplebullets.square-old .bullet.eighth:after{
content: 'Clients';
}

.tp-bullets.simplebullets.square-old .bullet.last:after{
content: 'Online';
}

Wednesday 11 September 2013

Safe Import of MySQL database

I've written a few blogs with this issue.  Here's a quick example of the code that I now wrap my imports in .  And I now have now charset or bad character issues.  I hope this helps you too.

Please note that the
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
will go infront of all the new tables that you're importing and
/*!40101 SET character_set_client = @saved_cs_client */;

goes after 


-- MySQL dump 10.13  Distrib 5.5.16, for Win32 (x86)
--
-- Host: localhost    Database: mine
-- ------------------------------------------------------
-- Server version 5.1.62-community

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE IF NOT EXISTS `wp_postmeta` (
  `meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `post_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `meta_key` varchar(255) DEFAULT NULL,
  `meta_value` longtext,
  PRIMARY KEY (`meta_id`),
  KEY `post_id` (`post_id`),
  KEY `meta_key` (`meta_key`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=7911 ;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `beforeUPDATEwp_postmeta`
--

/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
INSERT INTO `wp_postmeta` (`meta_id`, `post_id`, `meta_key`, `meta_value`) VALUES
(1, 2, '_wp_page_template', 'template-home.php');
/*!40101 SET character_set_client = @saved_cs_client */;
-- ----

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

Tuesday 10 September 2013

wordpress button Not Found The requested URL * was not found on this server.

If you've recently moved, transferred or have a new Wordpress installation then you may find the following issue when you click on a menu item / button.

Not Found The requested URL * was not found on this server.

the solution for me . ( on a unix server ) was to add the following as the .htaccess file at root.


# BEGIN WordPress

RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]

# END WordPress

Monday 9 September 2013

How to Add Pinterest Boards with Pin it buttons to your Wordpress website

!!note: this has been updated with version 1.01 of Pinterest to Wordpress by DeanDev

The mission here was to help make a website that intergrates with the clients Pinterest boards. 
Ideally I'd of liked to have the pages look as much like Pinterest as possible but have had to make some concessions because of time and investment. 

Here's an image of what I've achieved.



The plugins I've used are ->

Pinterest to Wordpress Plugin

I would have liked the Pin it button to have appeared as a roll over on the images like on Pinterest - as in this plugin Pinterest Pin it Button for Images but as the gallery on Pinterest to Wordpress Plugin uses script rather than '' tags it doesn't work .

So I used Pinterest "Pin it" Button

and used the following hack to show on Pinterest to Wordpress Plugin 

OPEN
wp-content/plugins/pinterest-to-wordpress/shortcodes.php

on line 103 FIND

$desc='
'.str_replace('/search', 'http://pinterest.com/search', urldecode($ttls[$i]) ) .'
';
REPLACE WITH
$pinitButton = do_shortcode('[pinit]');
     
     $desc='
'.str_replace('/search', 'http://pinterest.com/search', urldecode($ttls[$i]) ) .'
'.$pinitButton.'
';
You should also add some CSS to your style.css . I've used
div.PinItButton{
float: right;
margin-right: 4%;
}

Thursday 5 September 2013

Wordpress how to change admin menu name

I was going to do this task manually; but using this plugin seemed like the easiest way

 Wordpress how to change admin menu name

Wednesday 4 September 2013

Joomla Slideshow CK - how to show youtube Video


You'll notice while setting this module up that in the Video demonstrated it's for Vimeo; and is like 'http://player.vimeo.com/video/32575033'  .  You may also have noticed that if you use the Youtube URL that your video doesn't display.

What you need to do is enter the Youtube URL in the following format. You can get this from the Youtube EMBED code if you need it.  Otherwise just swap the Youtube ID for yours

http://www.youtube.com/embed/XWXN08oW-Ss

Thursday 29 August 2013

Issue adding new google analytics account

For some reason I couldn't find how to add a new Google Analytics account to the ones I already had.   Its fairly straight forward .

> go to 'admin' on the upper right

> You'll now have 2 columns -. Account , Property and View

> Click on 'Account'  and the last option is 'Create New Account'

Here's a pic.









Tuesday 27 August 2013

wordpress 3.5 contact form 7 failed to send your message. Please try later or contact administrator by another method.

On our website we started getting the following error when trying to send a message using the 'Contact Form 7' plugin on Wordpress 3.5.1 . 

'Failed to send your message. Please try later or contact administrator by another method.'

Here's the changes I made to get the plugin to work.

* The first thing I did was to fill in the 'To:' and 'From:' Fields. 

* I also made sure I used mail address that had the same domain as the server I'm sending from . Ie if your website address is  mywebsite.com  then address will be something like 'sales@mywebsite.com' 

* I also filled in the SUBJECT field with 'A Website Inquiry'

* And filled the Message Body with

The following is an inquiry from
   [your-name]

 [ your-email]

   [your-subject]

   [ your-message]


!!note: this is also a fix for 'contact form 7 not sending information to admin in message body'  if you are having that issue.

Here's a screen shot .


Thursday 15 August 2013

PAGE_FAULT_IN_HOMEPAGED_AREA on HP Pavillion dv2000

windows xp taskbar not working properly

how to fix windows taskbar XP


On a HP Pavillion dv2000 laptop the following text on a bluescreen would pop up really quickly.  After this message once windows xp had loaded the taskbar was not displaying properly.

Here's the text.

#####################

A problem has been detected and windows has been shut down to prevent damage to your computer.

PAGE_FAULT_IN_HOMEPAGED_AREA

If this is the first time you've seen this error screen restart your computer. If this screen appears again, follow these steps:

Check to make sure and new hardware or software is properly installed.  If this is a new installation, ask your hardware or software manufacturer for any windows updates you might need.

If the problems continue, disable or remove any newly installed hardware or software, Disable BIOS memory, options such as caching or shadowing.  If you need to safe mode to remove or disable components, restart your computer, press F8 to select Advanced Startup Options, and select safe mode.

Technical Information:

***** STOP: 0x00000050 ()

###############

Check this post for some inspiration on a fix http://www.tomshardware.co.uk/forum/277924-30-page_fault_in_nonpaged_area-problem

For me I had to fix this by pressing F11 and following the PC fix instructions. I'd recommend backing up in Safe Mode first though.



Monday 5 August 2013

AutoTweet NG basic showing on Facebook admin but not on other users statuses

I am using Joomla 2.5 and AutoTweet NG Basic version 6.5.2 but have a feeling this mistake will effect other version.

So basically what's happening is that you can see the post you've made but no one else can.  Also in the posts the reach will read as zero.



The solution is really simple.  Go back to you Facebook Developers page and click on the app you have created for this. 

On the main page under Basic info there is a selection for 'Sandbox' this needs to be set to 'Disabled' otherwise it's in test mode and only you as the developer can see the post.



Monday 29 July 2013

Sommerce transfer issues with Slideshow and Logo changes.

After transferring my Wordpress website that is using Jigoshop and Sommerce theme; I'm having issues with the slide show and logo that has reverted to default.

the error for these seem to be in this Mysql table

wp_options ->  option_name  > yiw_theme_options_sommerce 



As this is just for testing I'll leave this table as it's original when I transfer back.  Have you had this same issue ?  What was your fix ?


I'm sure I'll be adding to this blog at some point too.

Thursday 11 July 2013

Wordpress RSS feed not working XML Parsing Error:

If you're getting this message on your feed page.

XML Parsing Error: XML or text declaration not at start of entity
Location: *
Line Number 8, Column 1:


Then you need to add this plugin Fix Wordpress RSS Feed XML Parsing Error 

Once installed and activated you then need to go to

Tools > Fix my Feed

> and apply the fix



Wordpress Sommerce how to get rid of Welcome to Sommerce, a nice and fresh perspective to your e-commerce site message

This is set in Page editing section.  So for the homepage go to

Wp-admin > pages > 'home' > edit

The scroll down to 'Slogan Page' .  And change the text here.



Wednesday 10 July 2013

Problem with  in Posts in Wordpress

I haven't got this one fully sorted yet.  As I importing and exporting in UTF-8; why I'm still getting these  values is still beyond me.  If anyone reading this can point me in the right direction that'd be much appreciated.

However in the meantime the MySQL commands below are useful for cleansing the blogs

UPDATE wp_posts SET post_content = REPLACE(post_content, 'Â', '');
UPDATE wp_posts SET post_title = REPLACE(post_title, 'Â', '');
UPDATE wp_posts SET post_content = REPLACE(post_content, '˜', '');
UPDATE wp_posts SET post_title = REPLACE(post_title, '˜', '');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'Â', '');

Friday 5 July 2013

How to make a new virtuemart template

how to make a new virtuemart template

Are you having this problem 'Updating Virtuemart 2.0 changes my template'  .  This is because you've made all your changes in the 'default' template, which has been overwritten.  What you need to is make a copy of all the pages that start with 'default' from the folder
components/com_virtuemart/views/productdetails/tmpl/default.php

and paste them into a new folder in that directory; for example

components/com_virtuemart/views/productdetails/tmpl/wide/

replace all the references of 'default' in those filenames for your new one ie 'wide'

SAVE AND UPLOAD

from here make all your changes you want in that folder.  To apply this template to the product then that needs to done in Admin  >  Components > Virtuemart

You'll need to do this in all your products

> Product > Product Information

On the right hand side choose your Template name from the 'Product Details Page' dropdown .  as pictured here.

Thursday 4 July 2013

How to transfer a Joomla site and not get  characters

When transfer a database I was getting weird characters on the the new website. The problem was happening on the import from Mysql . Here's how to import the Joomla mysql database without  characters. In the mysql file find all the instances of CHARSET=latin1 and replace with CHARSET=utf8 that should do it. You may also find the post How to transfer using SSH useful, if you have shell access.

Tuesday 2 July 2013

Wordpress JQuery Sliding Out Widget Space

To do this I've used the plugin Jquery Slick Menu Widget . This slides out a menu but with a quick hack you can easily change it to pull out a Widget Space instead. Re. Add Widget space to wordpress Theme . Here's what I did . Open this page in your editor from the plugin. wp-content/plugins/jquery-slick-menu/dcwp_jquery_slick_menu_widget.php FIND
wp_nav_menu( array( 'fallback_cb' => '', 'menu' => $nav_menu, 'container' => false ) );
REPLACE WITH
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Slide Sidebar') ) : endif;   
OPEN the functions.php of your theme FIND
if ( function_exists('register_sidebars') )
ADD UNDERNEATH
 register_sidebar(array(
  'name'=> __( "Slide Sidebar", 'littleripples' ),
  'id' => 'slide-sidebar',
  'before_title'=>'
', 'after_title'=>'
' ));
SAVE AND UPLOAD. Thats it !!!!!

Sunday 23 June 2013

Wordpress Transfer Changes to Database

When transferring a Wordpress installation you need to change all the references to the old domain and replace it with the new.  Here's the MySQL 'find and replace' I used for mine.


update wp_options set option_value = replace(option_value,'wisemonkeymedia.co.uk','wmky.co.uk');


update wp_postmeta set meta_value = replace(meta_value,'wisemonkeymedia.co.uk','wmky.co.uk');

update wp_posts set post_content = replace(post_content,'wisemonkeymedia.co.uk','wmky.co.uk');

update wp_posts set guid = replace(guid,'wisemonkeymedia.co.uk','wmky.co.uk'

Friday 21 June 2013

Wadebridge to Padstow on the Camel Trail - Speeded up

Take a look at this video I've made


The intention is to show that the Camel Trail is suitable for All Mobility Access  - Where you can hire suitable bikes and trikes from this Wadebridge Bike Hire company

Joomla 2.5 Virtuemart transfer issue


UPDATE j25_virtuemart_category SET category_description = replace(category_description,"Â"," ");

UPDATE j25_virtuemart_category SET category_description = replace(category_description,"”","\"");

UPDATE j25_virtuemart_category SET category_description = replace(category_description,"–","-");

UPDATE j25_virtuemart_category SET category_description = replace(category_description,"…",";");



UPDATE j25_virtuemart_categories_en_gb SET category_description = replace(category_description,"Â"," ");

UPDATE j25_virtuemart_categories_en_gb SET category_description = replace(category_description,"”","\"");

UPDATE j25_virtuemart_categories_en_gb SET category_description = replace(category_description,"–","-");

UPDATE j25_virtuemart_categories_en_gb SET category_description = replace(category_description,"…",";");



UPDATE j25_virtuemart_products_en_gb SET product_s_desc = replace(product_s_desc,"Â"," ");

UPDATE j25_virtuemart_products_en_gb SET product_s_desc = replace(product_s_desc,"”","\"");

UPDATE j25_virtuemart_products_en_gb SET product_s_desc = replace(product_s_desc,"–","-");

UPDATE j25_virtuemart_products_en_gb SET product_s_desc = replace(product_s_desc,"…",";");

UPDATE j25_virtuemart_products_en_gb SET product_desc = replace(product_s_desc,"Â"," ");

UPDATE j25_virtuemart_products_en_gb SET product_desc = replace(product_s_desc,"”","\"");

UPDATE j25_virtuemart_products_en_gb SET product_desc = replace(product_s_desc,"–","-");

UPDATE j25_virtuemart_products_en_gb SET product_desc = replace(product_s_desc,"…",";");

UPDATE j25_virtuemart_currencies_en_gb SET currency_symbol = replace(currency_symbol,"Â"," ");



Thursday 20 June 2013

DF Marine Menu - Swap with a normal Menu.

The Menu on the theme DF_Marine is rather baffling .  As you can't control it from the normal access for a menu.

Looking at the code for it in /wp-content/themes/df_marine/header.php we get this code.

                $today = current_time('mysql', 1);
            if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5")):
        ?>
            
                  post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);             echo "
  • "; the_title(); echo '
  • '; }?>            
           



Let's have a look how a Menu is normall called up


And in functions.php

register_nav_menus( array(
        'header-menu' => __( 'Header Menu', 'littleripples' ),
    ) );


Here's some information on it in the Wordpress Function Reference.

http://codex.wordpress.org/Function_Reference/wp_nav_menu

To fix the df_marine theme menu issue .  Here's what I did .  Please use a child theme as I did for this, however I'll explain the changes as if hacking the main theme.

OPEN df_marine/header.php

FIND
if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5")):
        ?>
            
                  post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);             echo "
  • "; the_title(); echo '
  • '; }?>            
           


REPLACE WITH

     'menu-header', 'theme_location' => 'primary' ) ); ?>
                



SAVE


OPEN wp-content/themes/twentyten/functions.php 

register_nav_menus( array(
        'primary' => __( 'Primary Navigation', 'twentyten' ),
    ) );



SAVE

UPLOAD BOTH FILES

You'll now have a dropdown box in the admin area, where you can select a menu you set up .

goto
admin > appearance > menus 
see the 'Theme Locations' box on the left there.  See this image.  


change done for www.cameltrailcyclehire.co.uk

Resizing Images Perminant Change - inside your Wordpress Blog / Theme.

So you've got a theme where you'd like the images to display at a different size. You could change the image size on each individual post or you could make a change to your theme and from then on ( as long as the image you upload is bigger ) you will have that size image in your blog. There's two bits of code that are of interest
the_post_thumbnail( 'largeimage' );
This will be on your theme pages. In the case of what I'm making changes to its wp-content/themes/mytheme/category.php The function 'the_post_thumbnail' is from the Wordpress Framework and can is explained in the Function Reference here -> http://codex.wordpress.org/Function_Reference/the_post_thumbnail Here in my example the arguement 'largeimage' is being sent over to it. You will find this reffered to in the function.php of your theme ( or you can add the following line if needed )
add_image_size( 'largeimage', 420, 420 ); // Shop Page Thumbnails
This is referenced in http://codex.wordpress.org/Function_Reference/add_image_size PLEASE NOTE: this makes a new size when the image is uploaded. Meaning if you add this code after the blog is already up it will not work. http://www.padstowholidayaccommodation.co.uk

Monday 10 June 2013


Adding YouTube Videos to Tour Pages on Midway Responsive Wordpress Theme

Originally I wanted to add my embedded YouTube Video to the 'day' boxes on the left hand side of the Tour Pages on Midway Responsive Wordpress Theme.  As pictured here on the Polzeath Camping


Which looked fine on my PC.  However it messes up the Responsive aspect of this theme when you go small.  So making the site look awful on tablets and smart phones.

I added the Video just underneath the top gallery in the end.  I've tested this on a heap of views and it looks good. 

Here' what I needed to add to the code to make this work .  Please note I've made these notes as if you're hacking the 'Midway' theme but highly recommend you do this in a child theme concept. Also remember to make a full backup before attempting this.

OPEN wp-content/themes/midway/style.css

AT THE BOTTOM OF PAGE ADD

div.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px; height: 0; overflow: hidden;
margin-top: 5%;
}

.video-container iframe, .video-container object, .video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}


SAVE AND UPLOAD

OPEN wp-content/themes/midway/single-tour.php

FIND

           
       



UNDERNEATH ADD

            $youtubevideo=themex_youtubevideo($post->ID);
        if ($youtubevideo != NULL) {
        ?>
        
         


SAVE AND UPLOAD

OPEN wp-content/themes/midway/framework/config.php

FIND

array(    'name' => __('Facebook','midway'),
                            'desc' => __('Does this tour have a seperate Facebook Account','midway'),
                            'id' => 'facebook',
                            'type' => 'text'),    


ABOVE ADD

array(    'name' => __('YouTubeVideo','midway'),
                            'desc' => __('The id of the YouTube Video you want to show for this tour .  If any!.','midway'),
                            'id' => 'youtubevideo',
                            'type' => 'text'),    


SAVE AND UPLOAD

OPEN wp-content/themes/midway/framework/functions.php


################
All you need to do then to add further Videos is copy the Youtube id . Which is after the 'v=' in the URL.



FIND

function themex_emaillink($id=null, $before='', $after='') {


ABOVE ADD

function themex_youtubevideo($id=null, $before='', $after='') {
    
    $youtubevideo=get_post_meta($id,'_tour_youtubevideo',true);
    
    $out=$youtubevideo;
    
    return $out;
}  


SAVE AND UPLOAD

Thats all the changes to the site done.  Now you need to set the videos in the database.

You'll need to get the Youtube ID


> The goto your /wp-admin

> Go to 'Tours' on the left menu

> In the main window click on 'edit' - under the Tour you want to add the Video too.

> Scroll down to 'Tour Options' and paste the Youtube ID in . In the 'YouTubeVideo' input box. 



> then you'll need to click on 'update' - upper right hand side of the blog.



Wednesday 5 June 2013

Mobile Joomla on my home page on firefox goes to iphone version

After reading this post Mobile Joomla Forum I tried uninstalling and reinstalling but had the same problem.  However rather than further continueing to find a resolution for this I've decided to move away from using Mobile Joomla.

There's a couple things that have been bothering me about it.  Firstly I can't get my head around their code.  So hacking changes is difficult.  And after designing Responsive themes in Wordpress I've seen theres a better and easy way.  And I should have to pay $199 per year, per domain to be able to offer this to my clients.

JTouch -


However to do so on my Surfing Website means I would need to update Virtuemart 2  .  Which is too much outlay in time for the moment.  I will however get around to addressing this soon. 

Tuesday 4 June 2013

Adobe After Effects why are the layers greyed out


It's a bit like trying to learn how to drive but frustratingly you can't find where the ignition is but what I need to do is start creating layers.

This should be as easy as right clicking in 'Timeline' at the bottom.



However if this isn't working and when you click on > Layer > 

the dropdown here is all greyed out then you probably need to click on 'Create a New Composition' first.




Wednesday 22 May 2013

The dropdown menu on Photographer Theme by Organic Themes is not working

Here's a hack that fixed the issue for me.

OPEN  wp-content/themes/organic_photographer/header.php


REPLACE the code between






WITH SOMETHING LIKE- Please remember this is hacked for a speedy solution.  To do it properly you would extend a class to retrieve the menu information from the database.



   

getting rid of  values from Wordpress content.

Use this code in your Mysql Database.  Note: you may need to change the 'wp_' prefix.

UPDATE wp_posts SET post_content = replace(post_content,"Â"," ");

Wednesday 8 May 2013

Google Font not working on all Browsers

Just a quick heads up on Google fonts.  As although it displays fine on my browsers and computers at home; on my clients computer the text is unreadable.  Underneath is an image from my computer and then the clients.  Escape Surfboards








Things to check . 

> are you displaying your font at less that 100% 

> what are the font weights .  Some screens don't like the thinner font versions.  Try 500+

> this fixed the issues in my case.

Wednesday 1 May 2013

which f button how to show ie9 in ie10

how to show ie9 in ie10

ie 10 how to show in ie 9


Thanks to Microsoft for installing a feature on IE10 that means you can roll back the versions to check how your website looks on older version.

To access this you just need to press F12 when your in Internet Explorer 10

Tuesday 30 April 2013

Wordpress Installation Checklist

I've just knocked myself up a quick checklist for when I started a brand new Wordpress Install. I think its worthy of recording in the ether.


COMMENTS

> Activate Akismet if not then 'Disable Comments'
> Configure Permalinks
> Add Gravatar ( only needed for a site with comments enabled )


SECURITY

> Do not use wp_ as a database prefix. Doing so will only aid hackers.
> Remove the WordPress version from the website’s header. how to remove wordpress version from header ->
in this blog he says you don't need to worry about this if you have the latest version. However I would anyway, as at somepoint you may well not update as soon as a Wordpress Release comes out.
THIS IS A CHANGE IN FUNCTION.PHP so will be done after Theme is installed.

> Remove Admin username. ->
> Chmod the security of the directories to 755 and files to 644

Plugins

Yoast
WP Security Scan
WPZOOM - for mobile devices
DIgg Digg - floating social bar.
Jet Pack - Does it all.
Contact Form 7
WP-PAGENAVE
Breadcrumb NavXT
PHP Code Widget - So usefull for PHP developers; allowing to add PHP in any widget space
WP-DBMANAGER - access the database from the home of your Admin area.

Next you should check The THEME checklist before Theme installation

wordpress admin allow search engines in wordpress 3.5.1

This is is admin > Settings > and then look for Search engine visibility.

Monday 29 April 2013

My Wordpress Theme has a TimThumb script that i can't get to work

My Wordpress Theme has a TimThumb script that i can't get to work - Now What !! Having a look around the web it seems I'm not the only one that seems to have been struggling with getting the TimThumb script to work. Tim Thumb Issue Well here's my hack for a theme when all was lost. This is the code I had in the theme that called up the Tim Thumb script. Here's the call up from the template.
echo themex_thumbnail($post->ID,738);
And then the function in the templates functions.php
function themex_thumbnail($ID, $w = 0, $h = 0){
 global $blog_id;
 $src = wp_get_attachment_url( get_post_thumbnail_id($ID) );

 if (isset($blog_id) && $blog_id > 0) {
  $imageParts = explode('/files/', $src);
  if (isset($imageParts[1])) {
   $src = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
  }
 }

 $url = THEMEX_URI.'extensions/timthumb/timthumb.php?src='.urlencode($src);
 if($w = intval($w)){
  if($h!=0 && $h=intval($h)) { 
   $url.='&w='.$w.'&h='.$h.'&a=t';
  } else {
   $url.='&w='.$w;
  }
 }
 return $url;
}
Here's the call up I've replaced with
echo lrip_gallery_thumbnail($post->ID,'blog');
And the following function. You can add all your different sizes to this list, and change the 'blog' call up; for example 'small' !
unction lrip_gallery_thumbnail($ID,$size){  
 global $blog_id;
 $src = wp_get_attachment_url( get_post_thumbnail_id($ID) );
// going to explode using .jpg and fix on a new ending 
 $img_url_array = explode('.jpg', $src);
 if ($size=='small'){
 $img_url = $img_url_array[0].'-150x150.jpg';
 } elseif($size=='blog'){
 $img_url = $img_url_array[0].'-738x415.jpg';
 }else {
 $img_url = $src;
 }
 return $img_url; 
} 
As well as making a copy at the right size and with '-738x415' add to the end of the filename; we also need to make it so the Wordpress automatically makes additional sized images. Its pretty simple all you need to do is add this to the main function.php

add_image_size( '738x415', 738, 415, true );
the first part is the name reference. It'll stick the size on the end anyway. And then comes the sizes and at the end the 'true' tells us that the image will be cropped to these sizes. And that's it.

No access to wp-admin folder Error 310 (net::ERR_TOO_MANY_REDIRECTS):

I'm using simple-301-redirects and got this message The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. Error 310 (net::ERR_TOO_MANY_REDIRECTS): Take a look at this post Error 310 Error Which indicates it's probably a permissions problem . However in my case when going to check my Permissions i noticed the wp-admin folder had disappeared re-uploading my last copy fixed the issue.

PHP function to take a copy of your Database

On occasion you may only have FTP access to your website and need to take a snapshot of the database.  Here's a quick hack


Friday 26 April 2013

joomla 1.5 administrator started displaying recaptcha message

This has started in the last week on my Joomla installations. 

I get the messagein Joomla Administrator

Are you human?

We have detected an increased number of attempts to access this login page. To help us keep this website secure, please let us know that you’re not a robot by entering the text from the captcha below.



After doing a search for:

joomla 1.5 administrator folder recaptcha

joomla 1.5 administrator started displaying recaptcha message


 I found this post Joomla admin folder showing reCaptcha  - and it seems its something being added by shared host providers.

In my case Heart Internet.

Thursday 4 April 2013

Joomla Virtuemart Store - Google PageSpeed Insights telling me GZIP not working.

After running a page speed test on Google PageSpeed test it was coming up that many pages weren't being Gzipped.  Even though this GZIP test http://www.whatsmyip.org/http-compression-test/ was telling me GZIP was activated. 

I checked that the feature was active in Joomla .  This is in

> admin
> click on 'site'
> drop down to 'global configuration'
> click on 'server' tab
> and make sure the 'GZIP Page Compression' radio button is ticked.



What I did to solve the issue was to untick this feature and do the gzip by .htaccess instead.  

Here's a guide on to do this 'use gzip in .htaccess'

in short you need to use this code in .htaccess


SetOutputFilter DEFLATE


Wednesday 3 April 2013

Wordpress 'Fast Secure Contact Form' - setup for radio and Multiple Selections

I was getting this message after attempting to set up some different types of form inputs on www.mitweb.co.uk 

Error: A radio field is not configured properly in settings.

Error: A select-multiple field is not configured properly in settings.


To fix this .

>  go to your admin area

> on the left go to 'Plugins' and then 'FS Contact Form Options'

> Scroll down to 'Extra fields' and in the 'Label field' it needs to be formatted like

Colour:,Red;Green;Blue

so my radio box was ->  Message Type:,Quote;Order




Tuesday 26 March 2013

Facebook Marketing - 2013

Here's a couple of notes I took down while watching their introduction videos.

The Fanpage

> Change the cover photo

> Add opening times and some business information.

Connect to Fans with Ads

> Identify target Audience
> Create multiple ads for each audience
> Roll out winning ads and rotate regularly


The advertising Steps.

> get Fanpage ready

> connect to Fans with Ads

> Engage your fans with quality content

> Influence the friends of your fans


Making seperate Social Media buttons for each Tour in Wordpress Midway Responsive -

Working on Wordpress website with the theme 'Midway Responsive' I was asked the following question by the customer.

Change the Home page FB icon link to our main tours Social Media stream and if possible on each tour page we would like the social media links to be different?

Here's how I solved this problem; I'll show you how to do it for the facebook link, for the rest all you need to do is repeat the process but replacing 'facebook' for the media stream you want.

OPEN wp-content/themes/midway/framework/config.php

around line 360 find
//Tours			array(				'id' => 'tour_metabox',				'title' =>  __('Tour Options', 'midway'),				'page' => 'tour',				'context' => 'normal',				'priority' => 'high',								'options' => array(
ADD UNDERNEATH
array(	'name' => __('Facebook','midway'),							'desc' => __('Does this tour have a seperate Facebook Account','midway'),							'id' => 'facebook',							'type' => 'text'),	
SAVE

OPEN wp-content/themes/(your child theme name)/header.php

FIND
						

REPLACE WITH
					ID,'_tour_facebook',true)) { 					$facebooklink=get_post_meta($post->ID,'_tour_facebook',true);?>					

SAVE AND UPLOAD
It's also worth reading this about Taxonomy , which is the process that your using to add to the array http://codex.wordpress.org/Taxonomies

Monday 25 March 2013

Some changes to Wordpress Midway responsive theme

Here's a few requested changes that I had to make to the Midway Responsive theme.  with how I solved these issues.  Please note I've made a Wordpress child theme called Zeathcamping ; which is why the folders are directed to that and not 'Midway'

Remove the Price and other Bullets points from the Tour Pages. >


OPEN

wp-content/zeathcamping/single-tour.php 
Around Line 44 to 48 commented out. 



Make the pricing tables stand out more especially where there is a special offer etc maybe use colours or bigger text

First off I needed to go into the 'tour' pages in admin and add the text 'class="info" '  to the tables I'm improving.

Then OPEN
wp-content/themes/zeathcamping/style.css

at the bottom add.

table.info{
font-size: 1.2em;
font-weight: bold;
}

Make the "Book Now" buttons bigger

OPEN wp-content/themes/zeathcamping/style.css
.button.small.tour-button span {
font-size: 1.4em !important;
font-weight: bold;
padding: 1% 20%;
}
 
On Home page change order of tour can we change the order of the polaroids / tours. 


This order is taken from when the tour is added. So the simplest way to change the order was to change the date of when this was added.
 

>Go to wp-admin/
>go to tours on the left hand side


> take a note of the dates and click on the tour you want to move.
> on the upper right hand side; under 'Publish' click on 'edit' next to the “Published on:” text.






Change "travel guide" title on homepage to "Blog"
  • in admin > go to Pages > Home page

    find the code [one_fourth][title]Travel Guide[/title][posts number="1"]

    you can edit the number of blogs here also




Photoshop Stroke is coming out blurry everytime

Photoshop Stroke is coming out blurry everytime What you need to do is check that your Feather is set to Opx. And then redraw the circle again.

Tim_thumb issue in Wordpress in Midway Responsive travel theme

http://elementdesignllc.com/2012/01/how-to-fix-timthumb-using-a-virtual-directory-url-contains-tildes/

Sunday 24 March 2013

Joomla 1.5 Getting a list of CCB Forum users names and email

On a Joomla 1.5 setup where they are using the CCB forum I wanted to get a list of Names and email addresses of the forum users. here's the mysql I used for this.
SELECT ju.name,ju.email FROM `jos_ccb_users` AS jcu LEFT JOIN `jos_users` AS ju ON ju.id = jcu.user_id WHERE jcu.id > 1

Thursday 21 March 2013

Wordpress Plugin that shows your latest Ow.ly image in a Widget

This a follow up to the blog How to make a Wordpress Widget Plugin

My aim here is to make Wordpress Plugin that shows your latest Ow.ly image in a Widget .   If you make a folder called 'owdotly-image' in the 'wp-content/plugins/' folder  and then save the following code as file 'owdotly.php'  this will work.  I'll add some CSS to it and then try and get it added to the official Wordpress directory.


 __('This widget will show your latest Ow.ly image',''),));
}
  
  
  function form($instance) {     
    $instance = wp_parse_args((array) $instance, array( 'title' => '', 'twit_username' => ''));
    $title = $instance['title'];
	$twit_username = $instance['twit_username'];
?>
  

', $array); list($newimage, $junk) = explode('"', $imageplus); $info = 'Polzeath nowClick here for the latest image.'; return $info; } function widget($args, $instance) { $Title = $instance['title']; $User = $instance['twit_username']; echo "

$Title

"; echo ''.$this->get_owdotly_page($User).''; } } add_action( 'widgets_init', create_function('', 'return register_widget("Owdotly_Image_Widget");') ); ?>

How to make a Worpress Widget Plugin - Stage 1

Here's what I want to do: Grab the latest picture from my Ow.ly account ( which is what I send to from my mobile Twitter account ) .
The way I'd like to do this in Wordpress is to create a plugin. To create a Wordpress Widget then we need to extend the WP_Widget API. Make sure you follow the example here http://codex.wordpress.org/Widgets_API .

Here's my notes on how I did it; that may help you and will hopefully help myself to simplify the process when I come back to it in future.

 1. Once the Class is set up the key areas to remember are (http://azuliadesigns.com/creating-widgets-wordpress-28/)

 form() - this is whats called up in (Appearance -> Widgets)

 update() - saves the data weve entered above

 widget() - output the widget from the details we have above and what we've created in this class


The following code is to show the first stage of writing my plugin. I think it shows a good example of how the 'Sample Plugin' in the above link is expanded.

Notice how an extra instance is added to the form and how that is dealt with in 'update. The 'widget function' is at its most basic to prove we can save information and retrieve it.
/**
 * Plugin Name: Ow.ly Image Displayer
 * Plugin URI: http://www.littleripples.com/owdotly-image-displayer
 * Description: A widget that shows your latest Ow Dot image 
 * Version: 0.1
 * Author: DJ Millward
 * Author URI: http://www.littleripples.com
 * License: GPLv2 or later
 * Text Domain: owdotly-image
 */
 
 class Owdotly_Image_Widget extends WP_Widget 
{
  public function __construct()
{
parent::__construct('Owdotly_Image_Widget','Ow.ly Image Displayer Widget',
array('description' => __('This widget will show your latest Ow.ly image',''),));
}
  
  
  function form($instance) {     
    $instance = wp_parse_args((array) $instance, array( 'title' => '', 'twit_username' => ''));
    $title = $instance['title'];
	$twit_username = $instance['twit_username'];
?>
  

$Title
"; echo "$User "; } } add_action( 'widgets_init', create_function('', 'return register_widget("Owdotly_Image_Widget");') );