add_action(‘set_current_user’, ‘csstricks_hide_admin_bar’);
function csstricks_hide_admin_bar() {
if (!current_user_can(‘edit_posts’)) {
show_admin_bar(false);
}
}
<?php
$child_pages = $wpdb->get_results(“SELECT * FROM $wpdb->posts WHERE post_parent = “.$post->ID.” AND post_type = ‘page’ ORDER BY menu_order”, ‘OBJECT’); ?>
<?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild );
$i+=count($pageChild); ?>
<a href=”<?php echo get_permalink($pageChild->ID); ?>” rel=”bookmark” title=”<?php echo $pageChild->post_title; ?>”> <?php echo get_the_post_thumbnail($pageChild->ID, ‘full’); ?></a><br/>
<h3><a href=”<?php echo get_permalink($pageChild->ID); ?>” rel=”bookmark” title=”<?php echo $pageChild->post_title; ?>”><?php echo $pageChild->post_title; ?></a></h3>
<?php endforeach; endif; ?>
0WordPress Function
Jquery Include
<?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?>
2. Thumbnail Image
<?php the_post_thumbnail();?>
<?php the_post_thumbnail(‘thumbnail’); ?>
<?php the_post_thumbnail(‘medium’); ?>
<?php the_post_thumbnail(‘large’); ?>
<?php the_post_thumbnail(‘full’);?>
<?php the_post_thumbnail( array(100,100) );?>
3. Get Template Url
<?php get_template_directory(); ?>
<?php get_template_directory_uri(); ?>
0 How to Prevent Your WordPress Website from Being Hacked
- Keep your WordPress website updated with the latest version of WordPress. Wordpress is regularly upgraded with new functionality and wity security measures that help stop hackers.
- Use complex usernames and passwords as described above.
- Install security plugins such as Better WP Security. It covers most of the wordpress vulnerabilities mentioned earlier in this blog post.
- Install WP Security Scan. It will scan your code and look for anything that is out of place like malware. It will also make you aware of any vulnerabilities that it finds.
- Change the prefix of your WordPress database tables.
- Make the changes described earlier to your .htaccess file to prevent hackers from accessing important files that could cause vulnerabilities if accessed. Also make changes to your .htaccess file to prevent SQL injection and URL hacks.
- Move your admin panel login to a URL that is not so easily identified and not common. Limit the number of unsuccessful login attempts.
<?php
$all_categories = get_categories( ‘taxonomy=product_cat&hide_empty=0&hierarchical=1’ );
foreach ($all_categories as $cat) {
//print_r($cat);
if($cat->category_parent == 13) {
$category_id = $cat->term_id;
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, ‘thumbnail_id’, true );
$image = wp_get_attachment_url( $thumbnail_id );
/*echo ‘<a href=”‘. get_term_link($cat->slug, ‘product_cat’) .'”><div>’. “Read more” .'</div></a>’;*/
?>
<li style=”width: 183px;”>
<div>
<h3><?php echo $cat->name; ?></h3>
<div><img src=”<?php echo $image; ?>” alt=”<?php $cat->name; ?>” width=”120″ height=”120″ /></div>
<p><?php echo $cat->description;?></p>
<?php echo ‘<a title=”Edit Product” href=”‘.get_term_link($cat->slug, ‘product_cat’).'”>Read More</a>’; ?>
</div>
</li>
<?php
}
}?>
1 Checking to ensure that you and your web host have the minimum requirements to run WordPress.
2 Download the latest release of WordPress.
3 Unzip the downloaded file to a folder on your hard drive.
4 Be prepared with a secure password for your Secret Key
5 Print this page out so you have it handy during the installation.
Using Cpanel
- Log in to your cPanel.
- Click MySQL Database Wizard icon under the Databases section.
- In Step 1. Create a Database enter the database name and click Next Step.
- In Step 2. Create Database Users enter the database user name and the password. Make sure to use a strong password. Click Create User.
- In Step 3. Add User to Database click the All Privileges checkbox and click Next Step.
- In Step 4. Complete the task note the database name and user. Write down the values of hostname, username, databasename, and the password you chose. (Note that hostname will usually be localhost.)