wordpress-theming

Is WordPress's timezone supposed to be set to UTC within themes and plugins?

爱⌒轻易说出口 提交于 2019-12-20 04:19:00
问题 I'm building a custom theme and plugin for WordPress and noticed that calls to date_default_timezone_get() return "UTC" even though: PHP is configured to the local timezone. Wordpress is set to the local timezone in Settings:General:Timezone. Is this correct behaviour for WordPress, or do I have something misconfigured, a bad plugin, etc.? Do I need to switch to my local timezone before any calls to PHP's date and time functions (and then restore it later)? 回答1: Yes, WordPress does work in

Failed to import “Contact form 1”: Invalid post type wpcf7_contact_form Failed to import Media “db_site.sql_.txt”

ε祈祈猫儿з 提交于 2019-12-20 03:05:31
问题 I'm new to web development specially with wordpress. I created a website using wordpress as cms framework. I imported a database to my wordpress dashboard, all went well but the problem was some of the content was never imported successfully and the message is this, "...Failed to import Media “db_site.sql_.txt” and Failed to import “Contact form 1”: Invalid post type wpcf7_contact_form.." what could be the problem with this? I appreciate any help from you. Thanks!..=) 回答1: You are missing the

Parse error: syntax error, unexpected end of file but there is no error [closed]

吃可爱长大的小学妹 提交于 2019-12-19 12:00:33
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . This is my php code of index.php of a wordpress theme: <section id="content"> <?php $i=1; while(have_posts() && i < 7):the_post(); $tumbUrl = ''; if(has

If first post, style differently — Wordpress [closed]

谁说胖子不能爱 提交于 2019-12-19 11:34:39
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I need the first post that was ever posted to be styled differently. Is there a way that I can see if the post is first, and then change its contents? I currently have a div in all my posts. This needs to be replaced with different div . Apparently the following piece of code can

Wordpress - Show parent category AND subcategory name in subcategory archive URL

和自甴很熟 提交于 2019-12-18 15:17:43
问题 I'm having some trouble with Wordpress category/subcategory archive URLs. For example, I want to be able to display this archive: http://faroutmagazine.co.uk/wp/track-of-the-day while keeping its parent category in the URL, making it http://faroutmagazine.co.uk/wp/music/track-of-the-day Previously, I was just getting a "This is embarrassing..." 404 message when accessing the /music/track-of-the-day URL (even though that's the one that was appearing in the View option under categories in the

CSS background images in WordPress

泪湿孤枕 提交于 2019-12-18 13:05:13
问题 Is it possible to get a background image in CSS like you normally do in HTML when working with WordPress. I've tried doing this but it doesn't work. background-image: url("<?php bloginfo('template_directory'); ?>/images/parallax_image.jpg "); 回答1: PHP code cannot run in .css file, however you can use inline style, such as: <div style="background-image: url("<?php //url ?>");"> or <style> .class-name { background-image: url("<?php //url ?>"); } </style> The above would be useful when working

Looping through wordpress categories

元气小坏坏 提交于 2019-12-18 11:12:17
问题 I am new to Wordpress and been pulling my hair out trying to create a category loop. The loop is supposed to: loop through all categories echo out the category name (with link to echo out the last 5 posts in that category (with permalink to post) The html for each would be <div class="cat_wrap"> <div class="cat_name"> <a href="<?php get_category_link( $category_id ); ?>">Cat Name</a> </div> <ul class="cat_items"> <li class="cat_item"> <a href="permalink">cat item 1</a> </li> <li class="cat

Why pagination is not working and gives a 404 error on the wordpress site?

孤街醉人 提交于 2019-12-18 09:04:21
问题 Good day! The problem is this: in the template category(the archive) the pagination is not working, when you click on page 2 of the 404 error. Please help do not understand how to solve it, already all head broke My loop: <?php $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; $arg = array( 'cat' => get_queried_object_id(), 'post_type'=>'post', 'posts_per_page'=>9, //'order'=>'desc', 'paged' => $paged, ); $query = new WP_query($arg); if($query->have_posts()) : ?> <section

WP: how to remove version number in wp_enqueue_script?

岁酱吖の 提交于 2019-12-18 08:31:49
问题 I'm trying to remove the version number from appearing in the URL generated by wp_enqueue_script . It seems like I should pass a null on the 4th parameter per http://codex.wordpress.org/Function_Reference/wp_enqueue_script: wp_enqueue_script('jquery', false, array(), null, false); It's not working. I still see the version number. How do I remove that? Also, how do I use wp_enqueue_script so that I get jQuery from the Google CDN? 回答1: You can either use wp_enqueue_script('jquery', 'URL', array

How to add automatic class in image for wordpress post

妖精的绣舞 提交于 2019-12-17 10:29:52
问题 I want to make a responsive theme with Bootstrap 3. However, I need to automatically add the CSS class .img-responsive to every post image because I need the images to be responsive. Please suggest me what I need to add in WordPress's functions.php file or any other file that will allow me to add the CSS class automatically. 回答1: since you need to have it for all of your post images, then you need to add a hook for the content and add function add_responsive_class($content){ $content = mb