Checking if string contains numbers
is_numeric doesnt check strings for numbers. You need to use preg_match('#[0-9]#',$string)
is_numeric doesnt check strings for numbers. You need to use preg_match('#[0-9]#',$string)
*facepalm* $_POST is always set, it can only be empty.
If you are familiar with WordPress, you should already know that you should almost never have to use get_posts(). Your best bet is to use WP_Query . As good as wp_query is, you should still fine-tune it depending on your needs, it does make a difference. For example, if you just need 1 random post…
$get_current_page = str_replace(‘_page_’,”,strstr( current_filter(), ‘_page_’,false) ) ; // then you can do: <form method=”post” action=”<?php echo add_query_arg(array(‘page’ => $cph), admin_url().’admin.php’ )?>”>
I needed a placeholder for tags input but it’s boring to display the same tags every time. But unlike posts, WP doesnt have “rand” orderby paramater. So what you can do; is to get a #no of tags and shuffle them. So basically what we do is: Check if we have a recent transient If…
If you are using “page-template”s you’ll have problems with pagination since pages are not meant to display posts and some people frown upon using page-templates for custom archive display, but it’s sometimes the simplest way. Anyway the solution is 1.) to nullify the global $wpquery 2.) adding ‘paged’ => $paged arg. before displaying your posts…
SELECT CONCAT(‘ALTER TABLE `’, TABLE_NAME,’` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;’) AS mySQL FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA= “myschema” AND TABLE_TYPE=”BASE TABLE” Change “myschema” to your db_name , phpmyadmin will print out the commands you need to run… If any of them are trimmed with a “…” click “print view” select all commands and run.