wordpress-theming

Get Wordpress Category from Single Post

送分小仙女□ 提交于 2020-08-21 05:47:20
问题 I'm finishing up a WP theme, and I'm on the single.php template. I'm having some issues because I need to access the parent category that a post is in in order to display certain images and XML content. Here is an example of what I'm talking about. The following is the end url of a single post: /andrew/leaf-art-2/ /andrew/ is the category, and leaf-art-2 is the single post. When I am on the single post, I am having trouble getting single_cat_title(); to return the category that the current

Warning: Use of undefined constant register_nav_menu - assumed 'register_nav_menu' (this will throw an Error in a future version of PHP)

我与影子孤独终老i 提交于 2020-08-20 12:23:27
问题 Previously i am using PHP 5.6 , i wasn't see that problem ever. But when i am using php 7.3 i saw this problem arise. I am using latest wordpress version 5.2.3 . when I run my wordpress site in top of the page it shows the message Warning: Use of undefined constant `register_nav_menu` - assumed `register_nav_menu` (this will throw an Error in a future version of PHP) in `C:\xampp\htdocs\wordpress\newspaper\wp-content\themes\news\functions.php` on line 14 How can i solve this problem? 回答1:

How to create Feed section in wordpress for homepage

眉间皱痕 提交于 2020-08-10 20:29:05
问题 I am trying to do is, when a user post something from his account it will directly need to show on homepage on wordpress site. This will be for all user's role. Here i want to build a feed page like LinkedIn. Thanks in advance. 回答1: I'm assuming you have some knowledge... You could just add a loop restricted to a specific author... or user by grabbing the user ID. You could do something like this: <!-- Start page loop here --> <?php // 'post_type' => 'any' ... to display all post and custom

How to create Feed section in wordpress for homepage

一曲冷凌霜 提交于 2020-08-10 20:28:06
问题 I am trying to do is, when a user post something from his account it will directly need to show on homepage on wordpress site. This will be for all user's role. Here i want to build a feed page like LinkedIn. Thanks in advance. 回答1: I'm assuming you have some knowledge... You could just add a loop restricted to a specific author... or user by grabbing the user ID. You could do something like this: <!-- Start page loop here --> <?php // 'post_type' => 'any' ... to display all post and custom

Best way to override the WooCommerce category list Walker

六月ゝ 毕业季﹏ 提交于 2020-08-05 07:29:46
问题 What is the best way to override the woocomerce function that is in defined in the woocomerce plugins directory inside some class. For example I am wanted to change the function start_el declared in the class WC_Product_Cat_List_Walker . I can change the function code in the plugin directory by the changes remains until I upgrade the woocomerce plugin. How can I override it in my theme functions.php file? 回答1: try this... you can create a class and extend to WC_Product_Cat_List_Walker. class

Wordpress - how to show links to 'private' pages in wp_nav_menu?

本小妞迷上赌 提交于 2020-07-23 09:16:04
问题 In my WordPress site I have a requirement to show private links in the main navigation (via wp_nav_menu ) even if the user isn't logged in (I just need to show the link, not change who can view the actual content). I can do this elsewhere, using wp_list_pages and specifying the post_status(es) I want to display but I can't see how to apply that to wp_nav_menu . This works: wp_list_pages(array( 'title_li' => '', 'child_of' => $page->ID, 'post_status' => 'published,private' )); Is there a way

Wordpress - how to show links to 'private' pages in wp_nav_menu?

蓝咒 提交于 2020-07-23 09:15:20
问题 In my WordPress site I have a requirement to show private links in the main navigation (via wp_nav_menu ) even if the user isn't logged in (I just need to show the link, not change who can view the actual content). I can do this elsewhere, using wp_list_pages and specifying the post_status(es) I want to display but I can't see how to apply that to wp_nav_menu . This works: wp_list_pages(array( 'title_li' => '', 'child_of' => $page->ID, 'post_status' => 'published,private' )); Is there a way

Wordpress - how to show links to 'private' pages in wp_nav_menu?

不问归期 提交于 2020-07-23 09:14:25
问题 In my WordPress site I have a requirement to show private links in the main navigation (via wp_nav_menu ) even if the user isn't logged in (I just need to show the link, not change who can view the actual content). I can do this elsewhere, using wp_list_pages and specifying the post_status(es) I want to display but I can't see how to apply that to wp_nav_menu . This works: wp_list_pages(array( 'title_li' => '', 'child_of' => $page->ID, 'post_status' => 'published,private' )); Is there a way

How to apply ImageMagick effect (selective blur) to all WordPress uploaded images automatically ? I have Imagick installed

僤鯓⒐⒋嵵緔 提交于 2020-07-23 06:48:26
问题 I don't really know how to apply php code to WordPress manually. I have found some script but don't know where and how to put them. public Imagick::selectiveBlurImage ( float $radius , float $sigma , float $threshold [, int $channel = Imagick::CHANNEL_DEFAULT ] ) : bool <?php function selectiveBlurImage($imagePath, $radius, $sigma, $threshold, $channel) { $imagick = new \Imagick(realpath($imagePath)); $imagick->selectiveBlurImage($radius, $sigma, $threshold, $channel); header("Content-Type: