WordPress function and its use

<?php bloginfo(‘name’); ?> – Title of the Blog, or Blog Name

<?php wp_title(); ?> – Title of a Specific Page

<?php bloginfo(‘url’); ?> – Exact URL for the Site

<?php bloginfo(‘description’); ?> – Site’s Description

<?php bloginfo(‘template_url’); ?> – Location of Site’s Theme File

<?php bloginfo(‘stylesheet_url’); ?> – Link to the Style.css location

<?php bloginfo(‘rss2_url’); ?> – RSS Feed URL for the Site

<?php bloginfo(‘pingback_url’); ?> – Pingback URL for the site

<?php bloginfo(‘version’); ?> – WordPress Version Number

<?php get_header(); ?> – Displays Header.php file content

<?php get_footer(); ?> – Displays Footer.php file content

<?php get_sidebar(); ?> – Displays Sidebar.php file content

<?php comments_template(); ?> – Displays Comment.php file content

<?php the_content(); ?> – Displays the Content of the Post

<?php the_excerpt(); ?> – Displays the excerpt that is used in Posts

<?php the_title(); ?> – Title of the Specific Post

<?php the_permalink() ?> – Link of the Specific Post

<?php the_category(‘, ‘) ?> – Category of a Specific Post

<?php the_author(); ?> – Author of the Specific Post

<?php the_ID(); ?> – ID of a Specific Post

<?php edit_post_link(); ?> – Edit link for a Post

<?php next_post_link(‘ %link ‘) ?> – URL of the Next Page

<?php previous_post_link(‘%link’) ?> – URL of the Previous Page

<?php get_links_list(); ?> – Lists all links in Blogroll

<?php wp_list_pages(); ?> – Lists all Pages

<?php wp_get_archives() ?> – List Archive for the Site

<?php wp_list_cats(); ?> – Lists all Categories

<?php get_calendar(); ?> – Displays the Built in Calendar

<?php wp_register(); ?> – Displays Register Link

<?php wp_loginout(); ?> – Displays Login/Logout Link only to Registered Users

How to call webservice in php?

I have called web services in php by using curl function. In below I have given  one example.  I have sent XML Request by using curl function.Because My web services return data on XML Format.

$xml_data = ''; //pass parameter using XML request provide By webservices
$postData = array(     // You can pass parameter using Array and pass in postfields.

    'authId'=>'',
    'siteId'=>'',
    'countryId'=>'',
    'regionId'=>'',
	'weekType'=>'',
	'startDate'=>''
);

$URL = "http://www.yourwebservices.com/";

$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);

Continue reading

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' );

how to display article intro image in joomla module?

Article display by yourtheme/html/com_content/article/tmpl/default.php file.

you can use module mod_articles_latest so edit mod_articles_latest/tmpl/default.php file.

<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_latest
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;
?>
<ul class="latestnews<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
<li>
<a href="<?php echo $item->link; ?>">
<?php echo $item->title; ?></a>
<img src="<?php echo json_decode($item->images)->image_intro; ?>"/> //new line
</li>
<?php endforeach; ?>
</ul>

How to use login() function in joomla?

  • You can use Below code during develop module and component with login functionality, get your username and password dynamically and put in array function.
  • when you call registration successfully function just add this code for autologin  functionality.
  $credentials = array( 'username' => '$name', 'password' => '$password');
    $login_site =& JFactory::getApplication('site');
    $login_site->login($credentials, $options=array());

Sending HTML Email with PHP

<?php
// multiple recipients
$to  = 'receiver@example.com' ;

// subject
$subject = 'Simple Html Email';

// message with HTML body 
$message = '<html>
             <head>
              <title>Html Email With php</title>
             </head>
           <body>
             <div>". strip_tags($_POST['name']) . "</div>
             <div>". strip_tags($_POST['email']) . "</div>
             <div>". strip_tags($_POST['message']) . "</div>
           </body>
          </html>';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: hello <receiver@example.com>' . "\r\n";
$headers .= 'From: hello <sender@example.com>' . "\r\n";
$headers .= 'Cc: web@example.com' . "\r\n";
$headers .= 'Bcc: develope@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>

How to use mail() function in php?

mail() function

<?php
$to      = 'receiver@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: sender@example.com' . "\r\n" .
'Reply-To: sender@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

Note:-  $to, $subject, $message parameters are require for send mail and headers are optional parameter, you con use header parameter for add additional body mail.