“Exec-PHP” plugin allows us to add php codes in posts/pages
Tag Archives: Wordpress
How to check home page or not + wordpress
if (is_page('home') echo "Home page"; else echo "No";
How to Create Sitemap – WordPress
Use the plugin Google XML Sitemaps for XML sitemap .
Use the plugin HTML Page Sitemap for HTML sitemap .
How to display specific posts – WordPress
<?php $thePostIdArray = array("28","74", "82", "92"); // Post IDS $limit = 4 if (have_posts()) : while (have_posts()) : the_post(); $counter++; if ( $counter < $limit + 1 ): $post_id = $thePostIdArray[$counter-1]; $queried_post = get_post($post_id); echo $queried_post->post_title; endif; endwhile; endif; ?>
How to run a plugin function when a plugin is deactivated – WordPress
<?php register_activation_hook(__FILE__, $function); //The function "register_deactivation_hook" allow you to run a //plugin function when the plugin is deactivated. ?>
How to run a plugin function when a plugin is activated – WordPress
<?php //The function "register_activation_hook" allow you // to run a plugin function when the plugin is activated. register_activation_hook(__FILE__ , $function); ?>
WordPress widget to display content on specified pages
Follow the steps given below to use this widget
- Paste code on a file and save it inside folder
- Place this folder in /wp-content/plugins/
- Activate it using the menu plugins
- Drag the widget to the sidebar
- Fill the form and save the values .
- The content you entered will be displayed on given pages(based on the page value)
- If no value is entered for the field page url , it will show up on all pages
bloginfo function and its parameters
name = Testpilot .
description = Just another WordPress blog .
admin_email = admin@example .
url = http://example/home .
wpurl = http://example/home/wp .
stylesheet_directory = http://example/home/wp/wp-content/themes/child-theme .
stylesheet_url = http://example/home/wp/wp-content/themes/child-theme/style.css .
template_directory = http://example/home/wp/wp-content/themes/parent-theme .
template_url = http://example/home/wp/wp-content/themes/parent-theme .
atom_url = http://example/home/feed/atom .
rss2_url = http://example/home/feed .
rss_url = http://example/home/feed/rss .
pingback_url = http://example/home/wp/xmlrpc.php .
rdf_url = http://example/home/feed/rdf .
comments_atom_url = http://example/home/comments/feed/atom .
comments_rss2_url = http://example/home/comments/feed .
charset = UTF-8 .
html_type = text/html .
language = en-US .
text_direction = ltr .
version = 2.9.2 .