wordpress-theming

How do I show the number of images attached to a post on the image attachment page?

不打扰是莪最后的温柔 提交于 2019-12-09 18:35:55
问题 I use the image attachment page to show images attached to a post one by one, in a slideshow sort of affect. I'd like to be able to display the total number of images attached to the parent post and the number of the particular image that's being shown on any given attachment page so you see the picture and the words "Image 3 of 15" for example. Update... I was able to get the total number to show using this code: <?php global $post; $attachments = get_children( array( 'post_parent' => $post-

Template Overriding using a customization section

时光总嘲笑我的痴心妄想 提交于 2019-12-08 15:50:35
问题 I am trying to override my default templates from customization section, I am using code to do that, but if I am using it I am unable to assign a template to the edit-page page, Can anyone give an idea how both the customization section and edit-page assign template work. I want to set the template when I am creating a page and after assigning it I want to override. Consider I have a blog page, I want to assign it archive.php template and ten want to override It from customization section.

Can't remove function from wordpress WooCommerce hook using remove_action()

青春壹個敷衍的年華 提交于 2019-12-08 12:30:57
问题 Building an ecommerce site with WooCommerce. I am trying to modify the theme layout by removing functions from the default hook, and plugging them into another one (so they appear on a different part of the page. I've successfully removed one function and plugged it into another hook... remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40); add_action('woocommerce_below_single_product_display', 'woocommerce_template_single_meta', 40); That worked find,

Why this Wordpress page.php file contain the posts loop?

China☆狼群 提交于 2019-12-08 12:23:03
问题 I am pretty new in WordPress theme development and I have the following question about the page.php page contained into templates files (the file that describe the template for the static pages) I am analazyng the page.php file contained into the twentythirten default theme, the code of this file is: <?php /** * The template for displaying all pages * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages and that other * 'pages'

Why is the styling of these nearly identical pages different?

那年仲夏 提交于 2019-12-08 12:15:29
问题 I am creating my first custom WordPress theme and can't figure out why two nearly identical category template files are being displaying differently. The black-colored band at the bottom of this page should extend across the entire width of the page, like it does on this page, but for some reason it's not. The code for the correctly-styled template file is as follows: <?php get_header(); ?> <body class="projects"> <div id="page-container"> <?php get_sidebar(); ?> <div id="content"> <?php if

Twenty twelve header image and navigation in same line

最后都变了- 提交于 2019-12-08 11:19:18
问题 How can you put the navigation in the same line as the header image in twenty twelve? Right now the navigation menu is above the image, but I would like them to be next to each other. Is there any way to achieve this? Thanks! 回答1: Add "position:relative" to #masthead: #masthead {position: relative;} then position your navigation with position absolute: #site-navigation { position: absolute; bottom: 0; /* or top, if you prefer */ right: 0; } 来源: https://stackoverflow.com/questions/13199046

How to put own HTML into Wordpress theme?

寵の児 提交于 2019-12-08 10:45:33
问题 I installed a Wordpress theme, but I would need to put there my own HTML code. So, I would suppose I'll go into: wp-content/themes/theme_name/header.php and on the needed place I inserted needed HTML code. I did it, but it didn't affect the website - the newly put HTML elements are not seen in the website. Do I disregard anything? Or is needed to set up something in the WP administration? Or problem with cache? Sorry, maybe a stupid queston, I am just playing with WP for the first time. 回答1:

How to use Classic Editor with WordPress 5.0

时光怂恿深爱的人放手 提交于 2019-12-08 08:23:09
问题 Recently I updated the WordPress version to new 5.0 version. After the update it is showing me a different editor than I worked before. But I want to access previous editor I worked with. How can I get back to former WordPress editor? 回答1: Recently WordPress introduces its version 5.0. With this version WordPress has introduces the block-based editor instead of using former classic editor. How to get back to former editor? You need to install and activate Classic Editor plugin. This will add

How to get wordpress custom post data in json?

时光怂恿深爱的人放手 提交于 2019-12-08 07:09:07
问题 In my template file i fetch the custom post data like this , Initially I fetch 7 post, I need to make a read more button bellow the post, which will fetch more 7 posts from the wp database table, when someone click on it. But I don't know how to do it, I want to know about, In jquery get method, which php file i call for the data, How or what exact script i will write in that php file. 回答1: Here i have added a rough idea how you can write your code : Create a ajax function in function.php ,

Wordpress, filter posts if custom query variables are present. (pre_get_posts, add_vars)

我怕爱的太早我们不能终老 提交于 2019-12-08 07:01:01
问题 Basically, what I'm trying to do is filter my query if several variables are present, so that I can have something setup like this: Posts Filter Mockup I can do this with query_posts() , but I know that's terrible practice. So far, I've registered a couple of the query vars that I need to use, and I guess I just need to know how to include them in the query. Apparently what I'm using just doesn't work. // Add query vars for filtering by specific category ids add_filter('query_vars', 'add_vars