Display Most popular Posts In WordPress

Blog Archives

Display Most popular Posts In WordPress

Add code in your theme where ever you want the popular 5 posts to be displayed. <ul> <?php $pc = new WP_Query(‘orderby=comment_count&posts_per_page=5’); while ($pc->have_posts()) : $pc->the_post(); ?> <li><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a> <p>Posted by <strong><?php the_author()

Posted in Blog, Wordpress Tagged with: , , ,

How to add js and css in wordpress?

/** * Proper way to enqueue scripts and styles */ function theme_name_scripts() { wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); wp_enqueue_script( ‘script-name’, get_template_directory_uri() . ‘/js/example.js’, array(), ‘1.0.0’, true ); } add_action( ‘wp_enqueue_scripts’, ‘theme_name_scripts’ );

Posted in Blog, Wordpress Tagged with: , ,

Create Custom Post Type with Texamony(Categories) in WordPress

Custom Post types are very handy tool in wordpress. To create a custom Post Type is pretty easy. Goto functions.php file of your theme folder and copy the below code. You will get the new section for adding posts. These

Posted in Blog, Wordpress Tagged with: ,

Export the database table as CSV format using PHP

This code need some files those files are, 1.db.php 2.export.php 3.index.php as in the db.php file, make this. database name –> wallstreet table name–> export_table column names –> id,name,place and as you, here i just declare what i have given

Posted in Blog, PHP Tagged with: , , ,

Powerful WordPress Tips And Tricks

Posted in Blog, Wordpress Tagged with: ,

Drag and drop using jquery

Create .html file <link rel=”stylesheet” type=”text/css” href=”css/style.css”> <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js”></script> <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js”></script> <script type=”text/javascript”> $(document).ready(function(){ // Example 1.1: A single sortable list $(‘#example-1-1 .sortable-list’).sortable(); // Example 1.2: Sortable and connectable lists $(‘#example-1-2 .sortable-list’).sortable({ connectWith: ‘#example-1-2 .sortable-list’ }); // Example

Posted in Blog, Jquery/Ajax Tagged with: , , , ,

How to get latest article(post) in wordpress.

Get latest 5 post <?php $myposts = get_posts(”); foreach($myposts as $post) : setup_postdata($post); ?> Get featured image of article  <?php the_post_thumbnail(‘medium’); ?> Get post title and its link. <h3><a href=”<?php the_permalink() ?>” title=”<?php the_title_attribute(); ?>”> <?php the_title(); ?></a></h3> Get limit

Posted in Blog, Wordpress Tagged with: , ,

How to upload image in wordpress

  if(isset($_POST[‘submit’])&&$_POST[‘submit’]==’SUBMIT’){ //This is the directory where images will be saved $target = WP_CONTENT_DIR.”/upload/”; you have to create folder name upload in root directory(path: wp-content/upload/..) $target = $target . basename($_FILES[‘photo’][‘name’]); //This gets all the other information from the form //

Posted in Blog, PHP, Wordpress Tagged with: , , ,

How to share custom data on social network site !!!

For Facebook share <a id=”ref_fb” href=”http://www.facebook.com/sharer.php?s=100&amp;p[title]=<?php echo $ftitle;?>&amp;p[summary]=<?php echo $fdescription;?>&amp;p[url]=<?php echo urlencode($fshare_url);?>&amp; p[images][0]=<?php echo $fimage_url;?>” onclick=”javascript:window.open(this.href, ”, ‘menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600’); return false;”>&nbsp;</a> For Twitter share <a id=”ref_tw” href=”http://twitter.com/home?status=<?php echo $ttitle; ?>+<?php echo urlencode($tshare_url);?>” onclick=”javascript:window.open(this.href, ”, ‘menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600’);return false;”>&nbsp;</a>   For Linkedin share <a

Posted in Blog, Wordpress Tagged with: , , , , ,

How to display blog posts (Fishpig module) with featured images on magento homepage?

When we integrate fishpig with magento we can have one folder “wordpress” in the template folder.(path:- appdesignfrontendbasedefaultwordpress). in that we can create our custom folder like “xyz”. in that we need to create one .phtml file called “xyz.phtml”. the followings

Posted in Blog, Magento Tagged with: , , , , ,