wordpress-theming

Redirect When Search Query is an Exact Title in Wordpress

十年热恋 提交于 2019-12-12 01:48:27
问题 I have two post titles in Wordpress: post_title: gröband permalink: www.example.com/groband.html post_title: groband permalink: www.example.com/groband-2.html I want redirect when search query is " gröband " to www.example.com/groband.html if search query is " groband " redirect to www.example.com/groband-2.html 回答1: Edit your search template in theme editor and add this top <?php if(isset($_GET['s'])){ $url =""; switch($_GET['s']){ case 'gröband': $url = "http://www.example.com/groband.html"

Hide Custom Fields in New Post?

余生颓废 提交于 2019-12-12 01:30:10
问题 I just started out with WordPress and I'm having some problems with the custom fields. Here's the code from functions.php add_post_meta($post_id, 'Post Thumbnail', $post_thumb, true) or update_post_meta($post_id, 'Post Thumbnail', $post_thumb); add_post_meta($post_id, 'Project URL', $url, true) or update_post_meta($post_id, 'Project URL', $url); add_post_meta($post_id, 'Project Thumbnail', $thumb, true) or update_post_meta($post_id, 'Project Thumbnail', $thumb); The problem is that they show

wordpress user roles : contributer can not delete his/here post item

▼魔方 西西 提交于 2019-12-12 01:30:02
问题 Contributor can not delete/change his/her posted item after it has been published on wordpress blog. How can I do this? Ps: my purpose (read this to see the big picture) 回答1: I think this is the way WordPress intended it = though I thought the contributor could still edit the post, but have to submit it for revision again... Try using WordPress Role Manager to add the capability edit_published_posts to the contributor role. 来源: https://stackoverflow.com/questions/2979913/wordpress-user-roles

How to add a php file to wordpress theme addition of standard files?

白昼怎懂夜的黑 提交于 2019-12-12 00:16:41
问题 Wordpress themes have standard file such as header.php, footer.php, index.php, functions.php, style.css, ... How to add a php file to wordpress theme addition of standard files? for example I want add a news.php to display specific posts in it, please help me 回答1: Just add a new file (e.g. news.php ), and put the template comment at the very beginning: <?php /* Template Name: News Template */ Then, go to your Wordpress backend, create a new page, and select the template you created: 来源: https

At a certain breakpoint, the content from 2 masonry containers on the same page starts overlapping

点点圈 提交于 2019-12-11 23:59:56
问题 I am displaying the wordpress posts on my blog index page in a masonry layout. I also have the masonry activated on footer, to display the wordpress footer widgets in a masonry layout. So basically I have 2 masonry containers on the same page . 1. One for displaying the blog posts, and 2. Other for displaying the footer widgets. The html markup for the page looks like this: HTML <!-- Posts --> <main id="main"> <div class="testmason"> <article class="hentry">Post 1</article> <article class=

Can I create new page.php on child theme in wordpress?

北战南征 提交于 2019-12-11 23:42:52
问题 I would like to create new page (with specific style) on child theme. I created a page.php on child theme, however, it doesn't work. Instead of, parent theme's pape.php does. When I remove the parent theme's pape.php, it redirects index.php. Can I create new page.php on child theme in wordpress? 回答1: Sounds strange. As i understood you can overload all the files in your parent-theme from the child-theme by just creating a new -filename-.php. Here is som good reading Wordpress Child Theme 来源:

WordPress Ken Theme Error in Sidebar Editor - “Fatal error: Uncaught Error: Function name must be a string”

一个人想着一个人 提交于 2019-12-11 21:33:10
问题 Hello fellow developers and problem-solvers, I have come across this error in the WordPress dashboard in all of the existing Pages/Posts. Through my experience, I have learned PHP but I am not very experienced when it comes to core php file errors within WordPress itself. Based off similar posts, this could be a PHP version issue with PHP7, yet I'm not entirely sure. Also the theme itself may need to be updated, but I feel there should be a bug fix for this before I would consider updating

Custom category for custom post type

一个人想着一个人 提交于 2019-12-11 20:36:37
问题 I added a custom post type to my wordpress theme. I related with category taxonomy, I can relate with the same categories as the posts. What I need is a custom category for my custom post type. Eg: "book" for post type and book-category/fictional I need it to be different than post categories. Is this possible? 回答1: Yes sir it is possible! http://codex.wordpress.org/Taxonomies In a nutshell: function register_book_genre_taxonomy() { register_taxonomy( 'book_genre', 'book', array( 'label' => _

How to Display Custom Post Type's Gallery (images ) in Through WP_Query

喜欢而已 提交于 2019-12-11 20:21:31
问题 I am trying to load an Image Slider images from a Custom Post Type image Gallery Feature. For example let say I have an Custom Post Type called banner which I can load images to it's Gallery and I have an HTML code like this: <div class="item active"> <img src="assets/img/ban1r.jpg" alt=""> <div class="carousel-caption"> slide 1 </div> </div> <div class="item active"> <img src="assets/img/ban2r.jpg" alt=""> <div class="carousel-caption"> slide 1 </div> </div> Can you please let me know how I

Wordpress Future Page Issue (Not Showing)

我怕爱的太早我们不能终老 提交于 2019-12-11 19:48:21
问题 I've been asked to fix a problem on a wordpress site. The problem is caused by the fact posts should of been used instead of pages. However the site is up and running and quickest option would be to fix the problem using a hack of sorts. The site has an events section, each event is a page (this is the issue, should really be a post). In order to have upcoming and past events the post date is used, therefore upcoming events has a post status of 'future'. There's are list page of events which