Tag Info

New answers tagged

0

You should do echo output: <?php echo get_theme_mod( 'twitter' ); ?> <?php echo get_theme_mod( 'facebook' ); ?>


0

I had a pre_get_posts. What I missed was this: && $wp_query->is_main_query() This prevents the pre_get_posts to run on the menu query. Full code add_action("pre_get_posts", "custom_front_page"); function custom_front_page( $wp_query ){ if( is_admin() ) { return; } if( is_front_page() && ...


0

Are you trying to get WordPress to return content from multiple post types with that function call? e.g. pages and custom_post_type content? If so, you should switch to get_posts and specify the post types as an array: $pages = get_posts([ 'post_type' => ['page', 'custom-post-type'] ]);


4

The best way to solve this is to simplify your code. Right now, ScriptQueuer::QueueCss() is just a static method, and it is getting its data too late. You could use an immutable object instead and then just register one of its methods as callback. Example: class Enqueuer { private $stylesheets; public function __construct( ArrayObject ...


0

I created a theme the goal of integrating Twitter's bootstrap into Automattic's underscores with the smallest possible changeset. I'm keeping it up to date rather frequently with both _s and Bootstrap. Here is the link: https://github.com/ptbello/_strap At the time of writing, it's underscores' most popular fork http://forked.yannick.io/Automattic/_s


1

I would definitely avoid using 2 different wordpress themes and instead code for a more responsive website with CSS mediaqueries. It has worked out very well for me on the Wordpress websites I created. If you're not familiar with media queries, here's a very basic rundown. HTML -- <div class="box">hello world</div> CSS -- .box { ...


0

You can use bookmarks to achieve this. Add your menu like you'd normally do, but use link menu items instead of pages or posts. Construct the field for the links like this: #someid Then add a corresponding id to each section on your homepage template, or if you're building the homepage by looping through other posts (or pages), check their id in the markup ...


0

ahaaa :D it's success, I use CSS. Here the screenshot the code i use on single.php : <!-- post section --> <section class="post-section all-round grid"> <div class="content_wrapper"> <!-- YOUR CONTENT --> </div> </section> <!-- end .post-section --> <!-- comment section --> ...


0

As described in codex, in_category() checks categories directly assigned to the post. That means that if a post is assigned to a child category but not to the parent, using in_category() with the parent category will fail. Example: you have the category with ID 10, which is child of category 9. The post is assigned to category 10, not to 9. The following ...


2

wp_list_authors() now does have an exclude parameter. So you can exclude the authors you want by their user ID. It accepts: An array, comma-, or space-separated list of author IDs to include. Default empty. Examples: // exclude just the author with the ID 4 wp_list_authors([ 'exclude' => 4 ]); // exclude the authors with the IDs 4 and 7 ...


1

Don't worry! It's not a mess up thing, it's actually CSS minification. :) Minification is a way to serve less weight files to the visitors. But irony is, minified files are not good to read, and not good to edit too. :( It's actually for machine. To not to go in that way, just check your LESS compiler. Somewhere in it, you have checked the compiler to ...


0

Can I use this function (wp_get_sidebars_widgets) if the WordPress codex tells me it's marked as "private"? (here) Best regards, Gabriela


0

Right now you have: if ( $latest->have_posts() ) { while ($latest->have_posts()) : $latest->the_post(); ?> ... inside the loop <?php endwhile; } Which in pseudocode is: if we have posts foreach post show the post endforeach endif So you need to do this instead: if we have posts open wrapper div foreach post ...


0

If I understand you correctly, you want to modify your code so it looks like this at the top: <div class="new_wrapper"> <?php $args = array( and this at the bottom: <?php endwhile; } ?> </div> <?php $v = array(); It sounds like you may have been adding the <div></div> inside the <?php ?> code, which would have ...


0

You should open div right before argsand <?php and close it right after endwhile, if I got question right.


1

If you have something like _e('') just change it to something like _e('','a4jp') In this example, a4jp is the theme name (theme-slug).


0

First you should make some improvements to your template file. Try this: <?php get_header(); ?> <?php global $woo_options; ?> <?php if ( $woo_options['woo_featured_disable'] <> "true" ) include( TEMPLATEPATH . '/includes/featured.php'); ?> <?php $args = array( 'post_type' => 'infobox', 'order' => 'DESC', // DESC for ...


0

The wp_get_archives function in Wordpress does not support displaying dates. However my solution worked without using this function it's still probably handy for your or someone else his cause: In the functions.php file of your theme place the following: function recentPostsDate() { $rPosts = new WP_Query(); $rPosts->query('showposts=6'); ...


0

When I seemingly get nothing from an Ajax call I run Fiddler and examine the return when it comes to the request. The other day an Ajax call was failing inexplicably. Upon examining the return I saw another programmer was dumping an array into the output before I received my response. I never would have guessed that because the JavaScript never hit the ...


1

Your problem is probably because you do not return a json object but an html (actually mixed text and html), and you set jQuery to validate that the response is json, which it isn't. your code at the ajax handler should be something like $catshtml = wp_dropdown_categories(.....echo=0); $ret = array('data' => $catshtml); wp_send_json($ret); die(); on ...


0

It's actually used by WP to allow plugin developers change WP behavior. You can make your code flexible using do_action so other plugin/theme developers or simply yourself can change behavior of your code. For example imagine you have a WP loop in a theme framework. You would like to add breadcrumb at the top of it, here is the simplest method: ... ...


1

I like to keep my templates short and sweet, for this reason, bulky (or long pieces of) code like the code in your question, I tend move that into a function and then just call the function in my templates or use do_action() calls. I also split my functionalities between different functions files so that I don't end up with a functions.php which is 2000 ...


0

The maximum width of an image displayed in content is not just determined by the image sizes you set or CSS settings, it is also determined by the content width set in functions.php through code similar to the following if ( ! isset( $content_width ) ) { $content_width = 960; } You need to set this to your required size as well in order for the image ...


-2

Did you try width:100%; in your css?


0

The solution to your problem can be accomplished with a page template, but first we need to fix your previews code <?php /**/ function add_user_page($user_id){ $user = get_userdata($user_id); $role_with_page = "subscriber"; if( reset($user->roles) != $role_with_page ) return; //Exit if user role doesn't allows ownership of page ...


2

That depends on what the plugin does, whether your theme relies on it and whether it is your own plugin or not. For example, when it's a plugin that adds a custom post type with special theme pages and stuff (like events or a portfolio), than you should integrate it in your theme using your second method. On the other hand, when it's a plugin from an ...



Top 50 recent answers are included