.

.
Showing posts with label Wordpress. Show all posts
Showing posts with label Wordpress. Show all posts

Get Blog Post Outsite Wordpress


<?php
   require 'blog/wp-load.php';  
   ?>
<?php
//instantiate a WP_Query and get the latest 10 posts
$wp_query = new \WP_Query();
$wp_query->query('showposts=3');
?>
<?php
//Iterate through the returned posts. The starts the WP "Loop"
while ($wp_query->have_posts()) :
  $wp_query->the_post();
?>
<a href="<?php the_permalink() ?>" target="_blank">
                  <?php the_title(); ?>
                  </a>
<?php if(has_post_thumbnail())
              {?>
<a href="<?php the_permalink() ?>" target="_blank"><img src="<?php echo the_post_thumbnail_url('large'); ?>" style="width:100%;" ></a>
                <?php }?>
<?php //$authorId = the_author_ID();
              
                $args = get_avatar_data(the_author_ID(),'' );
               
      $imgurl= $args['url'];
     
      ?>
                    <img src="<?php echo $imgurl; ?>" style="border-radius:100%;width:80px;height:80px;z-index:999;margin-left:-15px !important;" align="middle">
                    <h3><?php echo ucwords(get_author_name());?></h3>
<?php the_time( get_option( 'date_format' ) ); ?>
  <p> <a href="<?php comments_link(); ?>">
    Leave a Comment
</a></p>
How to Allow my own theme to support multiple menus in wordpress

How to Allow my own theme to support multiple menus in wordpress

Add the following to your functions.php file. The 2 menus are the “Primary”, and “Secondary” menus.

/Register Navigations
add_action( 'init', 'my_custom_menus' );
function my_custom_menus() {
   register_nav_menus(
        array(
            'primary-menu' => __( 'Primary Menu' ),
            'secondary-menu' => __( 'Secondary Menu' )
        )
    );
}
To add them to your site you need to add the following to your WordPress template files (most likely your header.php and footer.php files).
<?php wp_nav_menu (array('theme_location' => 'primary-menu','menu_class' => 'nav'));?>
<?php wp_nav_menu (array('theme_location' => 'secondary-menu','menu_class' => 'nav'));?>
Adding .active class to active menu item

Adding .active class to active menu item

Add this code in function.php file in your theme
add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);
function special_nav_class($classes, $item){
     if( in_array('current-menu-item', $classes) ){
             $classes[] = 'active ';
     }
     return $classes;
}
How to Change site URL By htaccess file

How to Change site URL By htaccess file

I have to change the url Like its  satihoga.com . I want to change it http://www.satihoga.com/.
then I solve it .Its a wordpress project . & By permalinks & htaccess file I solve it.
By Changing in .htaccess file .
To change wordpress .htacces file in this:

.htaccess file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


RewriteCond %{HTTP_USER_AGENT} ^-?$

RewriteRule ^ - [F]

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^

RewriteCond %{HTTP_USER_AGENT} ^-?$

RewriteRule ^ - [F]



RewriteEngine on

RewriteCond %{HTTP_REFERER} !^http://www.satihoga.com/
</IfModule>

# END WordPress


And Also change in WP dashboard
Go to settings.
then General & Change the Site url & website address OR url  IN TO  http://www.satihoga.com/