WordPress

file permissions for WordPress


When you setup WP you (the webserver) may need write access to the files. So the access rights may need to be loose.

chown www-data:www-data -R /var/www/html/* # Let Apache be owner
find /var/www/html -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find /var/www/html -type f -exec chmod 644 {} \; # Change file permissions rw-r–r–

After the setup you should tighten the access rights, according to Hardening WordPress all files except for wp-content should be writable by your user account only. wp-content must be writable by www-data too.

chown : -R * # Let your useraccount be owner
chown www-data:www-data wp-content # Let apache be owner of wp-content

Maybe you want to change the contents in wp-content later on. In this case you could

temporarily change to the user to www-data with su,
give wp-content group write access 775 and join the group www-data or
give your user the access rights to the folder using ACLs.
Whatever you do, make sure the files have rw permissions for www-data.

Advertisements

Increasing the WordPress Memory Limit


1. Edit your wp-config.php file and enter something like:

define('WP_MEMORY_LIMIT', '96M');

2. If you have access to your PHP.ini file, change the line in PHP.ini
If your line shows 32M try 64M:

memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)


3. If you don’t have access to PHP.ini try adding this to an .htaccess file:

php_value memory_limit 64M

4. If none of the above works then talk to your host.

WordPress Manual Update


Manual Update

These are the short instructions, if you want more check out the extended upgrade instructions. If you experience problems with the Three Step Update, you may want to review the more detailed upgrade instructions

For these instructions, it is assumed that your blog’s URL is http://example.com/wordpress/.

Step 1: Replace WordPress files

  1. Get the latest WordPress zip (or tar.gz) file.
  2. Unpack the zip file that you downloaded.
  3. Deactivate plugins.
  4. Delete the old wp-includes and wp-admin directories on your web host (through your FTP or shell access).
  5. Using FTP or your shell access, upload the new wp-includes and wp-admin directories to your web host, in place of the previously deleted directories.
  6. Upload the individual files from the new wp-content folder to your existing wp-content folder, overwriting existing files. Do NOT delete your existing wp-content folder. Do NOT delete any files or folders in your existing wp-content directory (except for the one being overwritten by new files).
  7. Upload all new loose files from the root directory of the new version to your existing wordpress root directory.

NOTE – you should replace all the old WordPress files with the new ones in the wp-includes and wp-admin directories and sub-directories, and in the root directory (such as index.php, wp-login.php and so on). Don’t worry – your wp-config.php will be safe.

Be careful when you come to copying the wp-content directory. You should make sure that you only copy the files from inside this directory, rather than replacing your entire wp-content directory. This is where your themes and plugins live, so you will want to keep them. If you have customized the default or classic themes without renaming them, make sure not to overwrite those files, otherwise you will lose your changes. (Though you might want to compare them for new features or fixes..)

Lastly you should take a look at the wp-config-sample.php file, to see if any new settings have been introduced that you might want to add to your own wp-config.php.

Step 1.5: Remove .maintenance file

If you’re upgrading manually after a failed auto-upgrade, delete the file .maintenance from your WordPress directory using FTP. This will remove the “failed update” nag message.

Step 2: Update your installation

Visit your main WordPress admin page at /wp-admin. You may be asked to login again. If a database upgrade is necessary at this point, WordPress will detect it and give you a link to a URL like http://example.com/wordpress/wp-admin/upgrade.php. Follow that link and follow the instructions. This will update your database to be compatible with the latest code. You should do this as soon as possible after step 1.

Step 3: Do something nice for yourself

If you have caching enabled, your changes will appear to users more immediately if you clear the cache at this point (and if you don’t, you may get confused when you see the old version number in page footers when you check to see if the upgrade worked).

Your WordPress installation is successfully updated. That’s as simple as we can make it without Updating WordPress Using Subversion.

Consider rewarding yourself with a blog post about the update, reading that book or article you’ve been putting off, or simply sitting back for a few moments and letting the world pass you by.

Final Steps

Your update is now complete, so you can go in and enable your Plugins again. If you have issues with logging in, try clearing cookies in your browser.

Warning: file_get_contents(/home/coder4l6/public_html/wp-content/themes/enfold/config-layerslider/LayerSlider/sampleslider/sample_transitions.js) [function.file-get-contents]: failed to open stream: No such file or directory in /home/coder4l6/public_html/wp-content/themes/enfold/config-layerslider/LayerSlider/builder.php on line 14


Warning: file_get_contents(/home/coder4l6/public_html/wp-content/themes/enfold/config-layerslider/LayerSlider/sampleslider/sample_transitions.js) [function.file-get-contents]: failed to open stream: No such file or directory in /home/coder4l6/public_html/wp-content/themes/enfold/config-layerslider/LayerSlider/builder.php on line 14

Go to C:\xampp\htdocs\wordpress\wp-content\themes\enfold\config-layerslider\LayerSlider\builder.php

solution

// Get transition file
if(file_exists($custom_trs)) {
$data = file_get_contents($custom_trs);
} else {
$data = file_get_contents($sample_trs);
}

replace with

// Get transition file
if(file_exists($custom_trs)) {
$data = @file_get_contents($custom_trs);
} else {
$data = @file_get_contents($sample_trs);
}

How to Build a Custom WordPress Theme from Scratch


If you’re expert in  CSS and HTML, it’s very simple to create wordpress theme scratch. This overview shows the process of how to create custom WordPress theme  from scratch. Before getting stuck into the build process, it’s important to know how WordPress themes work. If you’ve looked at any prebuilt theme, you’ll notice that it’s all contained in a folder, and there’s around 12 core files. Some themes, including the Default WordPress theme, include more files which allow extra cucustomization but aren’t mandatory additions. Here’s an overview of the main files you’ll be working with:

  • header.php – Contains everything you’d want to appear at the top of your site.
  • index.php – The core file that loads your theme, also acts as the homepage (unless you set your blog to display a static page).
  • sidebar.php – Contains everything you’d want to appear in a sidebar.
  • footer.php – Contains everything you’d want to appear at the bottom of your site.
  • archive.php – The template file used when viewing categories, dates, posts by author, etc.
  • single.php – The template file that’s used when viewing an individual post.
  • comments.php – Called at the bottom of the single.php file to enable the comments section.
  • page.php – Similar to single.php, but used for WordPress pages.
  • search.php – The template file used to display search results.
  • 404.php – The template file that displays when a 404 error occurs.
  • style.css – All the styling for your theme goes here.
  • functions.php – A file that can be used to configure the WordPress core, without editing core files

1). go to  wordpress theme folder (“C:\xampp\htdocs\wordpress\wp-content\themes”) here am created a folder demo Capture 2).  then create all the above mentioned php files and css files in the theme ( “demo” ) folder. Capture 3).  Configuring the stylesheet open style.css and paste the below code /* Theme Name: Demo Theme URI: http://www.codersfort.com Description: Sticky WordPress theme Version: 1 Author: Ananthu krishna Author URI: http://www.codersfort.com */ 4). now we can activate our theme from appearance go to appearance-> activate our theme Capture

5). header.php
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset=”<?php bloginfo( ‘charset’ ); ?>” />
<meta name=”viewport” content=”width=device-width” />
<title><?php wp_title( ‘ | ‘, true, ‘right’ ); ?></title>
<link rel=”stylesheet” type=”text/css” href=”<?php echo get_stylesheet_uri(); ?>” />
<?php wp_head(); ?>
</head>

<body>
<div id=”mainwrap”>
<div id=”logodiv”></div>
<div id=”menudiv”><?php wp_nav_menu( array(‘theme_location’ => ‘top-nav’ , ‘container_class’ => ‘menu’)); ?></div>
<div id=”innerwrap”>

6). index.php (you can use the same code for page.php,single.php)

<?php get_header(); ?>
<div id=”leftwrap”>
<?php if(have_posts()): ?>
<?php while (have_posts()):the_post(); ?>
<?php the_title(”);?>
<?php the_content(”)?>
<?php endwhile ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

7). functions.php

<?php
add_action( ‘wp_enqueue_scripts’, ‘demo_load_scripts’ );
function demo_load_scripts()
{
wp_enqueue_script( ‘jquery’ );
}
// Register menus

if ( function_exists( ‘register_nav_menus’ ) ) {
register_nav_menus( array(
‘primary’ => __( ‘Primary Navigation’ ),
‘secondary’ => __( ‘Secondary Navigation’ )
));
}

function register_my_menus() {
register_nav_menus( array(
‘top-nav’ => __( ‘Top Nav’ )
)
);
}

register_sidebar(
array( ‘name’ => __( ‘Right Hand Sidebar’ ),
‘id’ => ‘right-sidebar’,
‘description’ => __( ‘right-hand side.’ ),
‘before_title’ => ‘<div>’,
‘after_title’ => ‘</div>’
));

?>
8). style.css

/*
Theme Name: Demo
Theme URI: http://www.codersfort.com
Description: Sticky WordPress theme
Version: 1
Author: Ananthu krishna
Author URI: http://www.codersfort.com
*/
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{font-size:100%;font:inherit;padding:0;border:0;margin:0;vertical-align:baseline}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:”;content:none}table{border-collapse:collapse;border-spacing:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}.clear{clear:both}
.sticky{}.bypostauthor{}.wp-caption{}.wp-caption-text{}.gallery-caption{}.alignright{}.alignleft{}.aligncenter{}
body{
background:#CCC;
margin-top:0px;

}
#mainwrap{
width:900px;
height:auto;
margin-left:auto;
margin-right:auto;
background-color:#FFF;
overflow:hidden;
}
#menudiv{
width:900px;
height:42px;
}
#logodiv{
width:900px;
height:100px;
}
.menu {
background-color:#CCC;
display: block;
float: left;
margin: 0 auto;
width: 100%;
height: 42px;
}
.menu ul,
div.menu ul {
list-style: none;
margin: 0;
padding: 0;
}
.menu li,
div.menu li {
float: left;
position: relative;
}
.menu ul ul {

display: none;
position: absolute;
top: 38px;
left: 0;
float: left;
width: 180px;
z-index: 99999;
}

.menu a {
color: #000;
display: block;
line-height: 42px;
padding: 0 10px;
text-decoration: none;
font-weight: normal;
}
.menu ul li:hover > ul {
display: block;
}
.menu li:hover > a,
.menu ul ul :hover > a {
background: #333;
color: #fff;
}

.menu ul ul a {
background: #333;
line-height: 1em;
padding: 10px;
width: 160px;
height: auto;
}

.menu ul li.current_page_item > a,
.menu ul li.current-menu-ancestor > a,
.menu ul li.current-menu-item > a,
.menu ul li.current-menu-parent > a {
color: #fff;
}
#innerwrap{
width:900px;
height:auto;
overflow:hidden;
}
#leftwrap{
width:600px;
height:auto;
float:left;
}
#sidewrap{
width:250px;
height:auto;
float:left;
}
#footerwrap{
width:900px;
height:100px;
background:#333;
}

9). Final Out Put

 

 

Capture