wordpress-theming

Remove title from custom post type edit screen

孤街浪徒 提交于 2019-12-11 10:19:55
问题 How can I apply the remove_post_type_support('email_template', 'title'); only for post edit screen? The title should be available on create and not for edit. 回答1: In WordPress, there is one global variable to check on which screen we are and it is global $current_screen but problem is it can not be used with admin_init action. So alternatively we can use load-(page) action to achieve it. add_action( 'load-post.php', 'remove_post_type_edit_screen', 10 ); function remove_post_type_edit_screen()

Wordpress - the_content doens't give p tags back

為{幸葍}努か 提交于 2019-12-11 09:17:26
问题 I'm using a piece of code that returns all of my pages on 1 page (custom wordpress theme). The code works perfectly, but I can't manage to output the pages with any p tags or formatting. $pages = get_pages(); foreach ($pages as $page_data) { $content = apply_filters('the_content', $page_data->post_content); $title = $page_data->post_title; echo $content; } I've read that you can use get_the_content, but I don't see how I can implemented this in my loop. Thanks G. 回答1: Try using wpautop

Wordpress 404 error when running this page

泄露秘密 提交于 2019-12-11 08:57:54
问题 I am trying to do a post from the frontend of Wordpress. I have the following code in a page called page-submit.php and while it has worked, I get 404 errors when the page is submitted but I don't know why or how to trace the issue. This page page_submit.php shows up fine and is located in my theme folder. Any suggestions? <?php get_header(); ?> <?php // Check if the form was submitted if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] )) { // Do some minor form validation

Adding caption area to 'Flexslider Plug-in'

让人想犯罪 __ 提交于 2019-12-11 08:48:01
问题 I have this question on the Wordpress stack exchange as well, but not having any luck there. So, as my solution probably involves me hard-coding php and css, It may be better to have it here. I'm using 'Flex Slider' plugin - that works on top of 'WP rotator' plug-in on my Wordpress 3.2 website. I have it implemented fine, and beginning to look at inserting my content - but I need to add a caption to be on top of the slider. As are present on most sliders on the web, within the documentation

How to stop WordPress creating multiple copies of images but keeping the size info?

风格不统一 提交于 2019-12-11 07:48:44
问题 I was wondering if it is possible to stop WordPress from creating multiple copies of imagens, but still keeping, let's say, "medium" size. I already edited my functions.php and the media options, leaving it all to "0", and it's fine. But, when I add an image do my post, the code reads as follow: <img src="http://example.com/wp-content/uploads/2019/08/image.jpg" alt="" width="2008" height="1004" class="aligncenter size-full wp-image-XXXX" /></a> I am using Jetpack and, for design reasons, I

Get a variable from one wordpress template file to another

若如初见. 提交于 2019-12-11 07:44:27
问题 I have a template file ( trendingPosts.php ) for showing 2 latest posts with the tag 'trending'. In the while loop for displaying these 2 posts, I take their ID's in an array so I can exclude them from the main wordpress loop later: <div id="trendingWrap" class="clearfix"> <?php $trending = new WP_Query(); $trending->query("showposts=2&tag=trending"); while($trending->have_posts()) : $trending->the_post(); $wp_query->in_the_loop = true; $currentTrending[] = $post->ID; ?> <div class=

Wordpress Theme Development Quick Start

江枫思渺然 提交于 2019-12-11 07:38:15
问题 I tried looking for a quick and dirty getting started with wordpress theme development tutorial. Now I know how to go and discover things myself, I'm looking for "top ten FAQ for programmers" when starting wordpress development. (For example, Turn on debugging and where the debugging option is located), how best to setup your dev environment. All I can find is elaborate or too low level or too high level guides to it. Coming from a background of creating custom wordpress-like applications

How do I combine pages (and their templates) into one page?

China☆狼群 提交于 2019-12-11 07:38:01
问题 I want the CMS to have the different pages (e.g. "Careers", "Jobs", "Team") with each having its own template, but then to combine them into one big scrollable page (e.g. "Our Company") that would have a template. How would I do this? I know there used to be a function get_page but that's been deprecated (and replaced with get_post which is not the same thing), but that doesn't retrieve the page's template. I want both the page and the template so I can output both into the main page. I also

Show Child-pages of Specific Parent on any page in Wordpress

落爺英雄遲暮 提交于 2019-12-11 07:37:41
问题 My website is build with alot of parents and childs. I am currently using the follow function: https://gist.github.com/mprahweb/3c94d9c65b32ec9e3b2908305efd77d5 However it doesnt achieve what i want. I can only use it under the parent. I want to be able to use a shortcode to list a child-pages for a specfic parent on any page (mainly the homepage) The dream would be that i could have a shortcode like this: [wpb_childpages_xxx] where xxx equals the parent page is this possible? 回答1: Here is

Wordpress query_posts adding two “post-entry” divs, one with “post-thumbnail” and one without

懵懂的女人 提交于 2019-12-11 05:32:48
问题 Hi my name is Antony and this is my first question. I'm currently making a worpress theme. And in the loop I want to have two "post-entry" divs one that's small that goes next to my post thumb, and one for without the thumb. I know that I need to do a <div class="post"> <?php if ( has_post_thumbnail()) { ?><div class="post-thumb"> <?php the_post_thumbnail(); ?> </div> <div class="post-entry-1"> <? } else { ?><div class="post-entry-2"> <?php } ?> Any help will be greatly appreciated, as I have