For plugin or custom wordpress theme we need create wordpress pages by script. In this article we given code to how to create wordpress pages by script.
how to create wordpress pages by script
You can create the pages by using script. You can execute any script using the “$wpdb->insert” or
“$wpdb->query”.
For creating wordpress post or page you can use the wp_insert_post function. Before calling wp_insert_post() it is necessary to create an object (typically an array) to pass the necessary elements that make up a post. The wp_insert_post() will fill out a default list of these but the user is required to provide the title and content otherwise the database write will fail.
You can use following code for creating the page. This code will execute when only you are logged in to wordpress.
// Create post object
$my_post = array();
$my_post['post_title'] = 'My post';
$my_post['post_content'] = 'This is my post.';
$my_post['post_status'] = 'publish';
$my_post['post_author'] = 1;
$my_post['post_type'] = 'page',
$my_post['post_category'] = array(8,39);
// Insert the post into the database
wp_insert_post( $my_post );
You can create wordpress plugin and use this code. Use following code for wordpress plugin. Copy the code and create the create_wordpress_pages.php file and put in plugin folder.
/*
Plugin Name: Create WordPress Pages
Plugin URI: http://images.purabtech.in/
Description: Create wordpress pages by script
Version: 1.0
Author: wordpressapi
Author URI: http://images.purabtech.in/
*/
function create_wordpress_pages(){
// Create post object
$my_post = array();
$my_post['post_title'] = 'My post';
$my_post['post_content'] = 'This is my post.';
$my_post['post_status'] = 'publish';
$my_post['post_author'] = 1;
$my_post['post_type'] = 'page',
$my_post['post_category'] = array(8,39);
// Insert the post into the database
wp_insert_post( $my_post );
}
register_activation_hook(__FILE__, 'create_wordpress_pages');
Nginx web server is becoming most popular in these year. Best server response time and minimum execution time is the advantages of Nginx server. wordpress.com itself using the nginx server for hosting these sites and blogs.
How to remove www from URL with nginx server
How to remove www from URL with nginx server
How to remove www from URL with nginx server
Many people want to remove the www from URL. I will tell you the tip how to remove the www from URL with nginx server.
Open your Ngnix configuration file (nginx.conf). Just use following code in server block.
if ($host ~* ^www\.(.*)) {
set $remove_www $1;
rewrite ^(.*)$ http://$remove_www$1 permanent;
}
Now these days keeping www in URL is becoming old fashion. How can check many websites for that and the current example is twitter.com. Using apache rule you can remove the www from url with rewite rule.
How to remove the www from url with rewite rule
How to remove the www from url with rewite rule
I specially dont like to put www in URL so we can easily remove the www from URL.
Open your apache configuration file. If you are using Linux then open file from following location
# vim /etc/httpd/conf/httpd.conf
put following lines in your virtual directory section.
Here we now goes to creating liquify effects it’s easy to easy to create photoshop liquify filter download. we given steps to create liquify photoshop filter.
How to create photoshop liquify filter download
If you constant on this effect you can make many more effect on only liquify
We can make effect liquify on text, images…etc
Now we just here look on liquify effect
Select text tool bar
First we select a text here I write a “liquify”
Before select liquify we have to retrize this text
Select layer >> reterize >> type
Select filter >> liquify
Now liquify having left side menu bar which you can select any option
Here is given below is liquify tool bar
Create your effect here we selected forward wrap tool
Here is tool option which is you select you can modify that tool as per your need
There is difference between post pagination and in post pagination.If you want to keep pagination in wordpress post without plugin, Than use our code
When we are developing the new wordpress theme then we need to always need to think about post pagination and in post pagination. Yes, there is difference between post pagination and in post pagination.
How to use pagination in wordpress post without plugin
How to use pagination in wordpress post without plugin
If you want to keep single post and pagination between in single post that is also possible through wordpress api. In this article I will show you hwo to use the in page or post pagination.
Open your single.php file from wordpress theme folder and put following code in that.
<?php wp_link_pages( ); ?>
We can pass the following parameter the this function.
Now I will explain What wordpress doing for using this function. WordPress is using simple explode php function for using the next page tag. Like following way.
In this photoshop tutorial, we will show, how to create burn effect in photoshop. Using any image you can add burn effect to image. we given full steps with screen shot and there steps in photoshop.
how to create burn effect in photoshop
First I select one image in PhotoShop
Select another image here I selected one ground image which image 2
In layer panel will look like below
Select layer 2 & give it opacity 62%
Now select first image
go to select >> color range
Cut the part of images
Now the second layer click indicate layer visibility
Many times we worked on this topic. In this tutorial we are going to show you, How to find mouse position and coordinates. we given code sample in article.
How to find mouse position and coordinates
[script]
/*
* This get_mouse_coordinates function we are using for capturing the Mouse coordinates of on browser
*/
var isIE = document.all?true:false;
if (!isIE) document.captureEvents(Event.MOUSEMOVE);
document.load = get_mouse_coordinates;
document.onmousemove = get_mouse_coordinates;
function get_mouse_coordinates(e) { // as per Document body
var x_pos;
var y_pos;
if (!isIE) {
x_pos = e.pageX;
y_pos = e.pageY;
}
if (isIE) {
x_pos = event.clientX + document.body.scrollLeft;
y_pos = event.clientY + document.body.scrollTop;
}
alert(x_pos);
alert(y_pos);
}
[/script]
clientX and clientY will work in only Firefox, safari, chrome and opeara. That will not work in IE browsers.
So We need to write condition for IE browsers.
In IE browser use window.event.x and window.event.y methods.