wordpress-theming

How can I set and get the values of a multiple select with the Wordpress settings API for a theme options page?

我只是一个虾纸丫 提交于 2019-12-10 21:12:37
问题 I want to use a 'multiple select field' for a field in the theme option page using settings API. I tried with the below code but unable to save all the selected values, it only saves last one selected. add_action('admin_menu', 'create_theme_options_page'); function create_theme_options_page() { add_options_page('Theme Options', 'Theme Options', 'administrator', 'inc/site-options.php', 'build_options_page'); } add_action('admin_init', 'register_and_build_fields'); function register_and_build

Yoast SEO Plugin not recognising content from the Wordpress Template

倾然丶 夕夏残阳落幕 提交于 2019-12-10 18:21:46
问题 I have developed a Wordpress website recently and used all the contents in the template itself. And all the pages and posts fields of WP admin is empty lacking content. So my content is present in my template and not in the post and pages field. I used Yoast SEO for this website and when checking with pages in WPadmin. No content is recognized and thus my SEO score is very low. But my content is present in the template which will be displayed in live also. Example: I want to optimize home

$.scrollTo not working in Chrome

别来无恙 提交于 2019-12-10 18:03:58
问题 I made a simple WordPress site with a theme called OneEngine. Here is a demo link: https://oneengine.enginethemes.com/ Interestingly, in Chrome the navigation does not appear to work. I have pinpointed the piece of script responsible for scrolling. // SCROLL TO $('#main-menu-top a,ul.slicknav_nav li a').click(function(event){ event.stopPropagation(); event.preventDefault(); console.log('Click event'); if($(this).hasClass('active')) return; $('#main-menu-top a').removeClass('active').css(

How to Change Style of Parent <li> on Hover

随声附和 提交于 2019-12-10 16:59:01
问题 I have a WordPress site (on my localhost) that uses a <ul> for a custom menu. How can I change the CSS of a <li> on hover only if it has a <ul> sub-menu? All the main menu items have a border-radius and I want to remove this on the current item (Services, below) for example: <div class="main-nav"> <ul class="menu" id="menu-main-nav"> <li><a href="#">Home</a></li> <li><a href="#">Services</a> <ul class="sub-menu"> <li><a href="#">Item One</a></li> <li><a href="#>Item Two</a></li> </ul> </li>

wordpress: media library issue with polylang plugin

十年热恋 提交于 2019-12-10 16:46:50
问题 I'm developing a website with Wordpress, where i'm using the Polylang plugin to make content for multiple different languages. I'm using Polylang for two languages: Dutch(primary) and English(secondary). When I upload images in Dutch pages, all is well. But when I create an English page, and want to add an image that is already been uploaded, the image library is empty. Anyone got an idea how to get them to appear there? Thanks! 回答1: I found the solution. It is default for the Polylang plugin

need help on archives pages in wordpress

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 16:08:36
问题 I want to build my own archives page that displays in the format that I want. I want to show all post title, order by month and year. It should look like this : December 2011 Post title 1 3 comments Post title 2 4 comments November 2011 Post title 1 2 comments I'm having trouble figuring out the specifics of the loop that needs to be created for getting the post title and it's comments order by month. This is the archives page example I want to build http://spyrestudios.com/archives/. Please

Wordpress + Woocommerce: hide unavailable variations when there are 2 attributes

送分小仙女□ 提交于 2019-12-10 15:44:40
问题 I have a variable product in WordPress + WooCommerce and it has 2 attributes: color and size. I'd like that when I select one of these 2 attributes, the unavailable variations with the second attribute will be automatically hidden (or unselectable) from the attribute select menu. Is it possible? How can I achieve that? I haven't found any plugin that can do that. I'm trying to figure out what part of code to edit, but it's quite a difficult task... 回答1: I ran into your (old) question as i had

Wordpress - adding Featured image to custom Post Type

眉间皱痕 提交于 2019-12-10 14:27:52
问题 I'm trying to add a Featured Image to my theme but not for Posts or Pages - I've created a custom type called Properties (its for an estate agent), so how do I enable Featured Image, as it doesn't appear in the sceen options? Hope someone can help, $property = new Cuztom_Post_Type( 'Property', array( 'supports' => array('title', 'editor') )); 回答1: $property = new Cuztom_Post_Type( 'Property', array( 'supports' => array('title', 'editor', 'thumbnail') )); I appear to have solved my own

How can I limit WordPress category selection to just one?

China☆狼群 提交于 2019-12-10 14:24:46
问题 I have a custom post type and a custom taxonomy setup - pretty standard stuff. However, I would like to know how I can restrict my client from selecting more than one taxonomy category per post? I don't mind them being able to create and delete taxonomy types, but I don't want them selecting more than one. Because these are checkboxes, they CAN. Perhaps radio buttons might work? I have seen solutions use jQuery to change these fields, but they seem a bit hacky. What's the best practice way to

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

為{幸葍}努か 提交于 2019-12-10 11:18:45
问题 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. 回答1: You can use the LESS mixins directly in your theme. If you want all images to be responsive you can say: //in your