custom widget in wp


register_sidebar( array(
'name' => 'Footer Sidebar 1',
'id' => 'footer-sidebar-1',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => 'Footer Sidebar 2',
'id' => 'footer-sidebar-2',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
register_sidebar( array(
'name' => 'Footer Sidebar 3',
'id' => 'footer-sidebar-3',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s">',
'after_widget' => '</aside>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );

 

 

call in

 

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer 1') ) : ?>
<li>
<?php endif; ?>
</ul>

XML Parsing Error: XML or text declaration not at start of entity in wp


DON’T PANIC!

There is a simple solution for this. It doesn’t require some crazy plugin. It doesn’t require hiring a super hacker geek to fix it AND it won’t require hours upon hours of Google’ing for the solution.

Now, if you want to try there are a few possible solutions. You can try:

  1. Reading this helpful article on the RSS Validator site: http://feedvalidator.org/docs/error/WPBlankLine.html
  2. Try the FIX RSS FEED plugin for WordPress (didn’t work for my clients site at all)
  3. Paying someone lots of money [like me Wordpress Remove Blank Line From RSS Feed   wordpress error on line 2 at column 6: XML declaration allowed only at the start of the document ] to do it for you.

Or you can simply do this yourself. It’s REALLY really simply and only require one file upload and one line of code. I’ll guide you through the whole process.

1) FIRST. Download the following filehttp://wejn.org/stuff/wejnswpwhitespacefix.php.

If you’re a geek you can check it for yourself, but I (Piotr Krzyzek) assure you this file is Virus free. If you don’t trust that file, you can download the exact same file from my server which I won’t change at all. So you can 100% rest assure that this file is safe from my server. You can get But if you download it from my server, rename the file from the “.ph” extension to “.php” so that it will work on your server too.

2) After downloading, upload the .PHP file into your WordPress site ROOT directory. This means wherever the wp-config.php file is. Do NOT upload it into the themes folder, NOR the plugins folder. Only the root directory.

If you don’t understand that, it’s ok. Leave a comment or poke me a twitter and I’ll explain it better.

3) EDIT your index.php file and add the following right after the first line:

include("wejnswpwhitespacefix.php");

So at the end, your index.php should look something like this:


<?php
include("wejnswpwhitespacefix.php");
define('WP_USE_THEMES', true);
require('./wp-blog-header.php');
?>

That’s of course a condensed version of the index.php file and your’s will probably have lots of comments and stuff in it. But the important thing is to add the include code right at the top.

After that, poof!

referenceError: Recaptcha is not defined


There is a problem with google (recaptcha) security certificate:

Code:

Firebug say:

Code:
Recaptcha is not defined
…oSAAAAAPiK1oCm_D2Kfjs2DTxWDJtcLpeJ”, “dynamic_recaptcha_1”, {theme: “white”,lang…
slove problem
include in index.php
<script src=”https://api-secure.recaptcha.net/js/recaptcha.js

></
script>
or
<script src=”https://api-secure.recaptcha.net/js/recaptcha_ajax.js“></
script>

Would need to change to:
<script src=”https://www.google.com/recaptcha/api/js/recaptcha.js“></
script>
or
<script src=”https://www.google.com/recaptcha/api/js/
recaptcha_ajax.js
“></script>

FIX next_posts_link() & previous_posts_link() ON FIRST AND LAST PAGE


<?php  $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;  ?>

<h1> <?php  $paged; ?></h1>

<?php

global $wp;

$wp_query->max_num_pages; ?>
<li><?php if(get_previous_posts_link()) { previous_posts_link(‘Previous &raquo;’); } else { echo ‘Previous’; } ; ?></a></li>
<li>Page <?php echo $paged; ?> of <?php echo $wp_query->max_num_pages;?> </li>
<li><?php if(get_next_posts_link()) { next_posts_link(‘&laquo; NEXT’); } else { echo ‘Next’; } ; ?></li>
</ul>

Could not create directory. /var/www/wordpress/wp-content/plugins/wordpress-importer/ Plugin install failed.


i have slove that plugin on Ubuntu server

If you want to add WordPress plugins manually without using FTP here are the instructions.
Example plugin i use Google Analytics.
First download plugin ZIP and extract it.

$ wget http://downloads.wordpress.org/plugin/google-analytics-for-wordpress.4.3.3.zip
$ unzip google-analytics-for-wordpress.4.3.3.zip

Move folder what came in the ZIP file in wordpress/wp-content/plugins. And remove useless ZIP file.

$ mv google-analytics-for-wordpress wordpress/wp-content/plugins/
$ rm google-analytics-for-wordpress.4.3.3.zip

Then you can go to your WordPress and choose plugins -> installed plugins and new plugin have came to the site and ready to be activated.

How To Install WordPress On Ubuntu


WordPress is a popular blogging tool powered by PHP and MySQL. WordPress has many features including plug-in support, customizable templates, and widgets that can be re-arranged easily without inserting a single PHP or HTML code. It can be easily customized into a content management system (CMS).

In this guide we will show you how to install the latest WordPress version locally on a system running Ubuntu 11.10/12.04 or older. To be able to install WordPress on Ubuntu, you need first to install a web server supporting PHP and MySQL. You can find  a tutorial explaining how to install LAMP (Linux,  Apache, MySQL, PHP) on Ubuntu.

WordPress Installation

1. Download first the latest WordPress version (currently v3.2.1) using this command from the terminal:

wget http://wordpress.org/latest.tar.gz

2. Extract the archive file with this command:

tar -xzvf latest.tar.gz

3. Create now a folder for WordPress in the /var/www directory using this command:

sudo mkdir /var/www/wordpress

4. Now move all WordPress files to this created folder using this command:

sudo cp -r ~/wordpress/* /var/www/wordpress

5. If you are installing WordPress in a subdirectory not in the root directory (/var/www), then edit the apache2.conf file with this command:

sudo gedit /etc/apache2/apache2.conf

And at the end of the file, insert this line:

AddType application/x-httpd-php .html

Save the file and close it.

6. Restart now Apache with this command:

sudo /etc/init.d/apache2 restart

7. Now we need to create a new MySQL database with a user having all privileges for accessing it. These details will be then inserted in the config file for WordPress. To create a new database, you may use phpMyAdmin, or simply run this command to login to the MySQL server (use the password you assigned to your MySQL server during LAMP installation):

mysql>

8. Create now a new database with this command (replace WordPress with any other name of your choice):

CREATE DATABASE WordPress;

If the command is successful, the returned output will be similar to this:

mysql> CREATE DATABASE WordPress;
Query OK, 1 row affected (0.01 sec)            

9. Add now a new user with this command (replace “username” with any name of your choice):

CREATE USER username;

10. Assign a strong password to this new user with this command (replace “123” with your own password):

SET PASSWORD FOR ‘username’ = PASSWORD(‘123’);

11. Grant now this user all privileges for the created database with this command:

GRANT ALL PRIVILEGES ON WordPress.* TO ‘username’ IDENTIFIED BY ‘123’;

WordPress –> Replace it with the name of the created MySQL database.
username –> Replace it with the username you have just created.
123 –> Replace it with the password you assigned to the MySQL user.

12. Once you finish, run this command to exit the MySQL server:

exit

13. Rename now the wp-config-sample.php file to wp-config.php using this command:

sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php

Note: If you are installing in another directory, then correct the given path to your own.


14. Edit now the wp-config.php file with this command:

sudo gedit /var/www/wordpress/wp-config.php

Insert now your MySQL settings you have just created by replacing:

database_name_here   —> with the database name you have created. For this tutorial, it’s named “WordPress“.
username_here  —> with the MySQL user you have created earlier.
password_here  —> with the password you assigned to the MySQL user.

Save your file and close it.

15. Open now one of these two links to set up your WordPress admin details (you will be redirected automatically):

http://localhost/wordpress/

or

http://127.0.0.1/wordpress/

16. Fill now in the following web forms, then click Install WordPress:

  • Site Title
  • Username
  • Password
  • Your E-mail

17. Login now to the admin section using the password you selected to start managing your blog:

18. Congratulations! Your WordPress blog is now successfully installed. Your blog is live at this link:

http://localhost/wordpress/

The admin section can be accessed here:

http://localhost/wordpress/wp-admin/

ubantu
go to  root directory
~$ sudo -i
password
baljit

connect to server
root@your-System-Product-Name:~# ssh 191.217.219.10
password
root
[ OK ]
root@wordpress:~# cd /var
root@wordpress:/var# cd www
root@wordpress:/var/www# ls
ls  command

list of directory
ls command

sudo cp /var/www/blog/wp-config-sample.php /var/www/wordpress/wp-config.php

sudo cp /var/www/blog/wp-config-sample.php /var/www/blog/wp-config.php
sudo gedit /var/www/blog/wp-config.php

GRANT ALL PRIVILEGES ON blog3.* TO root@localhost IDENTIFIED BY ‘root’;
GRANT ALL PRIVILEGES ON blog.* TO root@localhost IDENTIFIED BY ‘root’;