wordpress-theming

WordPress wpautop issue

荒凉一梦 提交于 2019-12-06 12:00:13
问题 I have disabled wpautop through the given code: remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); This function works. But my actual problem is that, it removes custom "p" tags that I have manually used in the content. So the problem is that when I don't use the above given code, there are automatic p tags that destroy my website and when I disable them, custom p tags are also disabled. 回答1: The easiest and simplest way to avoid wpauto issue is to

Random permalink key in wordpress

雨燕双飞 提交于 2019-12-06 11:52:41
问题 I want to have a custom permalink for each new post in WordPress like: http://mysite.com/x5Kvy6 (like bit.ly). I tried this little script, but it adds only 5-digit numbers to the post title in the permalink. function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) { if($slug!=""){ $random=rand(11111,99999); //I needed 5 digit random $slug .= "-" . $random; } return $slug; } How can I make a random key instead of the post title? I have not researched URL

Need help with remove_action()

十年热恋 提交于 2019-12-06 10:38:59
I'm trying to remove the unsightly embedded <STYLE> tag the built-in Recent Comments widget puts in my <HEAD> , but I can't seem to get the syntax right. It originally calls add_action( 'wp_head', array(&$this, 'recent_comments_style') ); to add it (in wp-includes/default-widgets.php, line 609 ), and I'm trying to undo it. I think it should be something like this: remove_action('wp_head', 'WP_Widget_Recent_Comments::recent_comments_style'); but with all the variations I've tried I still can't get it right. Does anyone know how to achieve this? Possibly Helpful: Function Reference: remove

I want to apply css class(bootstrap) .img-responsive on all content images

南楼画角 提交于 2019-12-06 10:31:10
I am developing a Wordpress theme with the help of bootstrap so I am manually applying cases on all content images like this: <img src="images/logo_03.png" class="img-responsive"> Is there any way to apply the same class properties automatically? I don't want to query for this purpose. I am sure bootstrap has a way to solve my problem, so let me know any solution with CSS. You can use the LESS mixins directly in your theme. If you want all images to be responsive you can say: //in your theme.less file img { .img-responsive(); } Will give you this in your theme.css file: img { //all Bootrap CSS

Wordpress Single post content not showing up

你离开我真会死。 提交于 2019-12-06 09:25:30
问题 I've got a wordpress blog theme which shows the content of all posts on the index fine but when I click into one of the posts the content of the post is blank and I can't seem to figure out why. If I'm correct the single.php controls that page. http://pastebin.com/afLVxMPb = My single.php an example of what I mean would be http://www.ndesign-studio.com/demo/wordpress/blog/how-about-a-blog-post-with-longer-title but on this site the content of the blog post does show up but on mine it doesn't.

Cannot add custom page template to my child theme

北战南征 提交于 2019-12-06 04:06:18
I'm running Wordpress 3.3.1. I'm writing a child theme that modifies the default twentyeleven theme. Everything seems normal, except that when I add a custom page template, it doesn't appear in the add/edit screen (so I can't use it!). To elaborate on "normal", here's what IS working: My child theme appears and activates normally. My CSS code (in style.css) is appearing. My files from the template hierarchy are working (ex: front-page.php, page.php) I've read and reread the codex, and my custom page template file ("coming-soon.php") seems to have the correct header: <?php /* Template Name:

Creating a “repeater fields” without a Plugin

谁都会走 提交于 2019-12-05 21:39:57
I want to create a repeater meta box without using any type of plugin. How can I get this metabox in my "selected template"? Developer add_action('admin_init', 'gpm_add_meta_boxes', 2); function gpm_add_meta_boxes() { add_meta_box( 'gpminvoice-group', 'Custom Repeatable', 'Repeatable_meta_box_display', 'page', 'normal', 'default'); } function Repeatable_meta_box_display() { global $post; $gpminvoice_group = get_post_meta($post->ID, 'customdata_group', true); wp_nonce_field( 'gpm_repeatable_meta_box_nonce', 'gpm_repeatable_meta_box_nonce' ); ?> <script type="text/javascript"> jQuery(document)

Hyperlinks A HREF do not work

ε祈祈猫儿з 提交于 2019-12-05 20:24:13
I'm a bit fooling around with a new website idea. But when i was testing it the A HREF does not work. It's not even showing a finger/hand pointer. It's the text at the content area (the first white block under the header, but not the menu ). The headers should be links to the posts (Wordpress). screenshot of the links that do not work (red arrows): http://new.go80.nl/screenshots/brokenlinksscreen.png Actually all the links in that area do not work. And at the Contact page not even the google maps work. I can't move around and can't click the links. Can somebody please help me figure this out?

wordpress: click on Parentpage Redirect on first child page programmatically

核能气质少年 提交于 2019-12-05 18:35:35
I want to redirect users on first child page. for example there is parent page: Page A it has 2 child pages: child1 and child 2 when user click on Page A that redirects user to child 1 page there are too many redirection plugins to redirect parent to child 1 that is manully set. I want this dynamically is it possible to redirect the parent page on first child page programmatically? Max Stern The following worked like a charm. ( http://www.wprecipes.com/wordpress-page-template-to-redirect-to-first-child-page ) To achieve this recipe, you have to create a page template. Create a new file and

Want to overwrite functions written in woocommerce-functions.php file

巧了我就是萌 提交于 2019-12-05 15:29:04
问题 I want to modify/overwrite functions written in woocommerce-functions.php file but I don't want to modify woocommerce-functions.php file. That is I want to achieve this in plug-in or in my theme. 回答1: It is possible to override woocommerce functions, I did this recently and added all of my woocommerce extended functionality to my theme's functions.php file so that the woocommerce plugin files remained untouched and are safe to update. This page gives an example of how you can remove their