wordpress-theming

pagination not showing on custom query (get_results)

馋奶兔 提交于 2019-12-13 06:26:26
问题 I followed this link and created my own custom query with pagination.. but I don't really understand how the offset works, https://wordpress.stackexchange.com/questions/21626/pagination-with-custom-sql-query the pagination does not work well. and I'm getting zero value for offset. function spiciest(){ global $wpdb, $paged, $max_num_pages; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $post_per_page = intval(get_query_var('posts_per_page')); //6 $offset = ($paged - 1)*$post

Getting “Error establishing a database connection” After Changing WordPress Theme's Files

纵然是瞬间 提交于 2019-12-13 06:20:58
问题 I just changed my WordPress theme's file settings (using WinSCP) and started getting this error. I checked both the site's main address and the wp-admin side. Both are giving me the same basic error. I'm using Google Cloud Compute to host a virtual machine running Apache/Debian with WordPress installed. Where do I check to make sure these values are correct? I know the DB Password is correct because I can see that in my Google Cloud Console. But why is it even giving me this error in the

Display 3 posts with different HTML markup in Wordpress using a loop

雨燕双飞 提交于 2019-12-13 06:01:50
问题 I want to be able to display 3 posts from the same category on my index.php page, but due to the way my site's HTML/CSS is coded I'm having some difficulty understanding the correct way to go about doing this using a loop (as the code for the divs being used are not the same for all three sections, it's using different CSS styles to achieve a layered effect/look ). Here is the HTML code. <div id="first-story" class="story"> <div class="content"> <h3 class="story-heading">Headline 1</h3> <ul>

Need help linking a button to a function in wordpress theme customizer

白昼怎懂夜的黑 提交于 2019-12-13 05:38:31
问题 I have created a custom control for the theme customizer which is a simple button and label. I am going to be using it as a theme reset button that will clear the theme mod settings to their original state. Now that I have added the control and have it showing up on the customizer, I am not sure where I am supposed to add the code to reset the settings. So far I have only created customizer settings for css and text changes. To remove the settings I will be using the remove theme mods

KALLYAS theme with WooCommerce plugin - Cannot remove sidebar on “Shop” page

那年仲夏 提交于 2019-12-13 05:07:18
问题 I'm using KALLYAS theme with WooCommerce plugin for an online store. My problem is, I can't remove the right sidebar on the Shop page. I tried several page layouts on this theme. But sidebar never goes. If I removed the sidebar from KALLYAS them options, it affects to other pages as well. Such as blog page. (I need sidebar on the blog page). So, if anyone have an idea of a solution, please be kind enough to reply... Thanks.. 回答1: make sure the page layout is set to "No sidebar" , along with

Find image or iframe with regular expressions

我只是一个虾纸丫 提交于 2019-12-13 04:50:07
问题 I've got the following code, it spits out the first image of each post, on WordPress: function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ //Defines a default image } echo "<img src=" . $first_img . ">"; } However, I also need to catch the first iframe, and echo whichever is first. I'm not experienced

Wordpress -how to return just current month posts on archive.php

守給你的承諾、 提交于 2019-12-13 04:49:36
问题 How to modify the wp_query to take in count post by month as per URL 2012/10/ ? The following will list ALL post, where I just want to list post for 2012/10/ $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'posts_per_page' => 10, 'paged' => $paged, 'orderby' => 'date', 'order' => 'DESC' ); $wp_query = new WP_Query($args); while ( have_posts() ) : the_post(); Any suggestions much appreciated. 回答1: There's a code snippet provided in the link from the earlier

2 Layouts for a WooCommerce shop

余生颓废 提交于 2019-12-13 04:45:49
问题 I have to categories named "Collectie" and "Shop", what I want is different layouts for the children of both categories. I already tried this with the template_include function like this: function lab5_template_include( $template ) { if ( category_has_children('collectie')) { $template = get_stylesheet_directory() . '/woocommerce/archive-product-collectie.php'; }elseif ( is_product_category('shop')) { $template = get_stylesheet_directory() . '/woocommerce/archive-product-shop.php'; } return

wordpress site work on local but not works on online server

若如初见. 提交于 2019-12-13 04:39:22
问题 my wordpress site correctly working on local server but when i am uploading it on server 404 page not found error is showing. i check my index.php its correctly redirecting. here is code:- <?php define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php'); ?> i check my wp-blog-header.php,its also working.because i forward it to phpinfo page and info page showing,but site page not showing. here is wp-blog-header code:- if ( !isset($wp_did

How to limit no of comments in a page in wordpress

情到浓时终转凉″ 提交于 2019-12-13 04:26:52
问题 I am creating feedback page in wordpress application. I am using <?php comments_template(); ?> code in my template file. I don't know how should I limit no. of comments in a page. Basically I want that it should display 4 comments in the feedback page. After 4 comments there should be pagination of comments. Please help me... 回答1: in the admin panel- Settings > Discussion > Other comment settings > Tick - Break comments into pages with [NUMBER] ...... 来源: https://stackoverflow.com/questions