Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]

Not sure if that’s what you need, but take a look. // Can be put into function.php if ( !is_admin() ) { add_action( “wp_enqueue_scripts”, “enqueue_scripts”, 11 ); } function enqueue_scripts() { // Theme CSS (style.css) wp_enqueue_style( ‘style-file’, get_template_directory_uri() . ‘/style.css’,false,’1.0′,’all’ ); // JS wp_register_script( ‘script’, get_template_directory_uri() . ‘/your-script.js’, array(‘jquery’) ); wp_enqueue_script( ‘script’ ); } Or … Read more

check if comment submitted was successful

You can use wp_insert_comment($data); function to check your comment is submit or not. This function will return (integer) The new comment’s ID. on success & (boolean) false if the insert failed. Hope this will helps you

404 error when I acess the second page of post-type

For modifying the main query, I think it is best to take advantage of the pre_get_posts action. When using pre_get_posts the $query variable is passed “by reference” which means we can directly manipulate the $query object with the shortcut functions such as set_query_var. Remove the query code from your taxonomy template, and try the following … Read more

Generate sidebar depending on height of post

JavaScript is definitely the way to go. Have a look at jQuery’s height() and outerHeight() functions. outerHeight() includes margins and padding, height() doesn’t. To keep this as simple as possible I would render a fixed-height sidebar initially (from WP/PHP) where the height is a sensible estimate of your longest post and then use JavaScript to … Read more

Using custom tables for old posts

a simple and Not perfect solution which will do most of the job for you is to overwrite the table names like this: function custom_prefix_change($sql) { global $wpdb,$wp; $prefix = $wpdb->prefix; if(is_single()){ //check if the post exists in the genuine posts table $results = $wpdb->get_results($sql,”ARRAY_A”); if($results[0][‘ID’]){ //if exists then return return $sql; }else{ //else change … Read more