<?php $items = wp_get_nav_menu_items( $menu, $args ); ?>
Here $menu can menu name,id or slug
$args can be
<?php $args = array(
‘orderby’ => ‘menu_order’,
‘post_status’ => ‘publish’ );
?>
<?php $items = wp_get_nav_menu_items( $menu, $args ); ?>
Here $menu can menu name,id or slug
$args can be
<?php $args = array(
‘orderby’ => ‘menu_order’,
‘post_status’ => ‘publish’ );
?>
<?php
$menuId=51;
foreach(wp_get_nav_menu_items($menuId) as $menu) {
echo $menu->title.”<br />”;
}
?>
$args = array(
‘post_type’ => ‘attachment’,
‘numberposts’ => null,
‘post_status’ => null,
‘post_parent’ => $post->ID
);
$pczAttachments = get_posts($args);
if ($pczAttachments) {
foreach ($pczAttachments as $values) {
echo apply_filters(‘the_title’, $values->post_title);
the_attachment_link($values->ID, false);
}
}
Add the below given code in to your functions.php
global $wpdb;
$templateQry = “select meta_key from $wpdb->postmeta where meta_key like ‘_wp_page_template’ and meta_value like ‘Template1′”;
$result = $wpdb->query($templateQry);
if ($result) {
echo “page Template1 is active”
} else {
echo “page Template1 is not active”
}
Add the below given code into your functions.php
function phpcodez_check_word($content){
global $post;
$num = 50; // set number of words required in a post
$content = $post->post_content;
if (str_word_count($content) < $num)
wp_die( __('The post does not have the minimum number of words') );
}
add_action('publish_post', 'phpcodez_check_word');
Paste the below given code in the wp-config.php
define(‘WP_MEMORY_LIMIT’, ’32M’);
Paste the below code in the functions.php
add_filter(‘wp_default_editor’, create_function(”, ‘return “html”;’));
Paste the below given code into functions.php
add_action( ‘admin_head-post.php’, ‘phpcodez_editor_font’ );
add_action( ‘admin_head-post-new.php’, ‘phpcodez_editor_font’ );
function phpcodez_editor_font() { ?>
<style type=”text/css”>#editorcontainer #content, #wp_mce_fullscreen { font-family: “Times New Roman”, Verdana, }</style>
<?php }
global $wp_query;
if(“entry_value”== get_post_type($wp_query->post->ID))
echo “Its a custom post type”
Paste the following code in your .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.*phpcodez.* [OR] // please add your domain name
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
</IfModule>