wordpress-theming

Permalink change each post update in wordpress

ε祈祈猫儿з 提交于 2019-12-07 13:30:27
I want to have a custom permalink for each new post in WordPress like: http://mysite.com/x5Kvy6 . function wp_unique_post_slug($col,$table='wp_posts'){ global $wpdb; $alphabet = array_merge( range(0, 9), range('a','z') ); $already_exists = true; do { $guidchr = array(); for ($i=0; $i<32; $i++) $guidchr[] = $alphabet[array_rand( $alphabet )]; $guid = sprintf( "%s", implode("", array_slice($guidchr, 0, 12, true)) ); // check that GUID is unique $already_exists = (boolean) $wpdb->get_var(" SELECT COUNT($col) as the_amount FROM $table WHERE $col = '$guid' "); } while (true == $already_exists);

Wordpress Theming: add custom scripts and jquery the correct way

我怕爱的太早我们不能终老 提交于 2019-12-07 12:22:41
问题 Just took over a wordpress project. The former developers screwed up the theming so it prevents my ajax forms (gravityform) from working correctly. Proplem is the way they add jquery and custom js in header.php: <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.easing.1.3.js"></script> <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/slides.min.jquery.js"></script> <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js

How to include jQuery in a WordPress theme?

十年热恋 提交于 2019-12-07 04:46:15
问题 I am pretty new to WordPress and I am figuring out how to include jQuery into a theme. I create the following function into functions.php theme: function load_java_scripts() { // Load FlexSlider JavaScript that handle the SlideShow: wp_enqueue_script('jQuery-js', 'http://code.jquery.com/jquery.js', array(), '1.0', true); } add_action('wp_enqueue_scripts', 'load_java_scripts'); So I think that I can add it as some other JavaScript or CSS local resources but I am not sure about this method

How to hide a template in Wordpress? [closed]

大城市里の小女人 提交于 2019-12-07 04:25:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . Is there a way to hide a template file in admin? For example I have a template that should only be available if a specific plugin is installed, and I already know how to check if plugin is active. But how do I hide the template? For example I want to hide "Blogger Redirection"-template bellow: I have found

Bootstrap Wordpress theme dev - How to use WP loop to generate span6 in a span12 layout

情到浓时终转凉″ 提交于 2019-12-07 01:03:35
I'm currently working on a wp theme project and i am trying implement the loop on a class = "span6" in a 12 grid layout, such that it will generate a 2 col magazine grid structure of all my wp post. but the different span six wont align properly, only the first two aligned well. in a static page, i would normally implement the grid layout like so: <div class="row-fluid"> <div class="span6">Content</div> <div class="span6">Content</div> </div> <div class="row-fluid"> <div class="span6">Content</div> <div class="span6">Content</div> </div> <div class="row-fluid"> <div class="span6">Content</div>

How to force wp_enqueue_style to display CSS at the very bottom of the head tag to override all CSS rules?

旧时模样 提交于 2019-12-07 00:34:57
问题 I am currently studying on how to create Wordpress administration templates via plug-ins, and according to the Wordpress Wiki you can use hooks such as admin_head , wp_admin_css , and/or login_head to manually echo your link html tag: echo "<link rel="stylesheet" type="text/css" href="' . get_option('siteurl') . '/wp-content/plugins/blue-steel/login.css" />'."\n"; The example obviously is A Bad Thing because of the way the link tag is hardcoded inside php logic. The ideal is to use wp_enqueue

How does my completely blank Wordpress theme works?

不问归期 提交于 2019-12-06 22:06:30
I made a test. i have a Wordpress site using Elementor page builder (pages, archives, header, footer... everything made with Elementor page builder). Now i made a theme which contains only two files: index.php style.css The index.php file is completely blank. nothing inside it. The style.css file contains the basic theme config comment thing. Everything works great on the site. and my question is why? For example how does the head part adds the used plugins if the theme doesn't contain wp_head() any where? Also (Second Question) - what am i missing? where would this completely blank theme will

Woocommerce - How to show Order details (my-account) on a separate page

点点圈 提交于 2019-12-06 14:15:28
问题 Right now, in woocommerce the shortcode [woocommerce_my_account] displays the entire "My Account" page with all the tabbed options. I only want to show the order details (found under the Orders tab) on a separate page. So, can I just use the woocommerce template orders.php (woocommerce/templates/myaccount/orders.php) and use it on a blank new page or is there a better way to go about it? 回答1: Woocommerce has function woocommerce_account_orders() which includes Orders template. You can follow

Display page content using multiple templates - WordPress

你说的曾经没有我的故事 提交于 2019-12-06 13:20:55
Is it possible to have a page like: www.site.com/page/ and show different templated versions using, say: www.site.com/page/?template=default www.site.com/page/?template=archive ...? So it retrieves the same page content but displays it differently. Is this possible with WordPress? Is it standard or would need some tomhackery to do this? Thank you Create a 'master' template and assign it to your page. The master template doesn't contain any layout information—just a set of conditional include statements that selects the 'real' template based on the GET variable. The master template might look

Change HTML language from en-US in to en-GB in WordPress?

Deadly 提交于 2019-12-06 12:21:20
This may sound like a simple and trivial question, but I'm using the following tag in a WordPress theme header file: <html <?php language_attributes(); ?>> Which is outputting: <html dir="ltr" lang="en-US"> I wish to change the lang attribute to "en-GB" as my blog and the language posts are written in are British English (en-GB) but I can't find where this parameter is set in the WordPress admin settings, and there isn't a value for it in the wp_options database table either, which leaves me to believe setting the lang value must be some sort of dark art? Define the language attribute using: