Articles of parameter

how to load posts to a custom post template after using template_redirect or template_include

I need to use the URL parameter ?m=1 to load every page of my wordpress with a different template but the problem is that I can’t pull the text and posts that can be accessed using the canonical URL I tried different methods the best one that worked for me is using template_redirect action hook […]

Sortby parameter to sort users

So for my post list, currently these are sortby post_count. Now, I am trying to sort the posts by “most newest” or “recent” Here is how the shortcode works [sortby=post_count] Other parameters can be found from Order & Orderby Parameters, however I could not find parameter for “most newest.” Any suggestions?

What is wrong with my WP_Query Arguments?

In my single.php file I am using a nested WP_Query to show more posts, at the bottom of the page. My code for the query and nested loop are as follows: <?php $ep_args = array( ‘post_type’ => ‘post’, ‘category_not_in’ => 93, ‘orderby’ => ‘rand’, ‘posts_per_page’ => 4, ‘offset’ => 1, ); $ep_query = new WP_Query( […]

query_posts with meta_value

I have category ‘news’ http://localhost/foldername/news, for each ‘news’ posts I have custom field called ‘years’ and is set up as a Text Field. I have 2 values assigned n different posts ‘2013’ and ‘2014’. What I’m trying to do first to show only 2014 posts in ‘news’ category http://localhost/foldername/news and second to pass url parameter […]

How to get setting from separate file?

I writing a wordpress plugin, that connects to external database and fetch data. Also it create custom button for vitual editor. By clicking this button modal window has been opened, and after that I load form to this window by ajax. I created php-file as handler for ajax requests. I need to get options from […]

shortcode – multiple instances of same parameter name in one shortcode instance

I’m looking to include a shortcode that builds a table of items and groups of items. For this I wish to be able to include an attribute multiple times or chain them together in some way. An example is I would like to do something like this: [testcode item=”item1″ group=”group1″ item=”item2″ item=”item3″ group=”group2″] alternatively something […]

Where is this function's callback getting its arguments from?

This might be better suited to Stack Overflow, thought I’d try here first though. I was walking through this tutorial by Justin Tadlock and encountered the function below being used as the callback argument for the add_meta_box function. My questions concern the parameters… function smashing_post_class_meta_box( $object, $box ) { wp_nonce_field( basename( __FILE__ ), ‘smashing_post_class_nonce’ ); […]

why do I have to use required parametres?

Why, when I want to use add_filter( ‘author_link’, ‘foo’, 10, 3 ); function foo ( $link, $author_id, $author_nicename ) {} I have to use 3 required parametres? Why cant I do this: add_filter( ‘author_link’, ‘foo’ ); function foo ( $author_id ) {} If you can, please give me some literature about this. PS beginner in […]

Passing parameters to a static front page

I have googled a lot, but so far haven’t come close to a proper solution yet. I need help with passing parameters to the homepage of a WordPress website. Here’s my setup / requirements: I use a page template (say, MCTemplate) that is set as the static front page in Settings -> Reading. I use […]

missing argument 2 when passing arguments to add_action

I wanted to pass arguments to a function triggered by an add_action hook. I followed the codex on this. I got a warning and the result was erratic, with an unexpected behavior. This question has already been adressed before without answers. I could reproduce this problem with a simplified function echoing the 2 arguments it […]