Tag Info

New answers tagged

1

The problem is problably here: <form id="oselector" method="GET" action="<?php the_permalink(); ?>"> Your code is not in the WordPress Loop. According to the Function Reference (emphasis added): the_permalink() - Displays the URL for the permalink to the post currently being processed in The Loop. This tag must be within The Loop, and is ...


0

to solve this you can create a page template, on this page template 1.get the top level categories only, set parent value to zero $args = array( 'orderby' => 'name', 'parent' => 0 ); $categories = get_categories( $args ); 2.get posts in all parent categories foreach ( $categories as $category ) { ...


0

This is a simple built-in function for displaying custom fields for the current post, known as the "post-meta" (stored in the wp_postmeta table). It formats the data into an unordered list. It must be used from within The Loop or in a theme file that handles data from a single post (e.g. single.php). the_meta() will ignore meta_keys (i.e. field names) that ...


3

Hm, first of all your page template has to be inside your current theme folder: /wp-content/themes/current-theme/ or in a similar folder. Check the Codex (Page Templates #File Folders) to make sure your template is in the right folder. While looking at the Codex also check the Selecting a Page Template section above if you did everything the right way. Your ...


0

Meta function don't support wildcards in keys. You could probably go through SQL, but it would probably be easier to use get_post_custom() to retrieve whole meta and pick out items you need. It is heavily cached inside so it would probably be more robust that custom solution as well.


1

The name comes from get_option('blogname'). So you can filter it in a mu-plugin: add_filter( 'option_blogname', 'local_blogname' ); function local_blogname( $name ) { return "✋ $name"; }


0

You can't add the ID at registration because there is no ID until after the user has registered. (See a possible way around this near the bottom). You could tack on the ID after the registration with the user_register hook. function add_ID_wpse_99390($a) { global $wpdb; $user = new WP_User($a); $wpdb->query("UPDATE {$wpdb->users} SET user_login ...


0

Did you try going back to permalinks settings page and hitting save again? Sometimes after making edits the permalinks need to be reset by visiting that page and doing nothing but saving.


0

In your CSS file add the rule: body.home.custom-background { background: <new background>; } This will overwrite the body.custom-background with the new background css rule that you require.


0

Sounds like you ... Don't have mod_rewrite installed or enabled Or your .htaccess file in not being edited To check the first make a file with <?php phpinfo(); in it, save it to your server-- same place you have Wordpress-- named something like phpinfo.php, and load the file in a browser. Look for mod_rewrite. It should be near the top in the "Loaded ...


1

What you want to do in this case is to use a meta_query in WP_Query like the following. You can reference the following Codex for more information https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters. Once you have the posts. Loop over them and add their date as data attribute, and filter the items using data attributes. $args = ...


1

I don't have comment capabilities, but the problem is very likely to be on the MS server side, specifically the URL Rewrite module. This is what handles permalinks on IIS. There is a hotfix for this problem, but you should probably apply all the hotfixes available for your system.


0

Brian Fegter's answer is almost perfect. In my testing his answer will only work if you change the actions to "wp_trash_post" and "before_delete_post" function restrict_post_deletion($post_ID){ $user = get_current_user_id(); $restricted_users = array(21,25,54,2,19); $restricted_pages = array(2,21,52,64); if(in_array($user, ...


1

Invalid Feed template message sometimes due to having a page or post with same name. Wordpress doesn't handle attributes with overlapping names (reused names) well.


2

I am not sure there is a way to suppress all these links, but you can hide them with CSS: add_action( 'login_head', 'hide_login_nav' ); function hide_login_nav() { ?><style>#nav,#backtoblog{display:none}</style><?php } Result:


6

Our journey starts here with the WP_Customize_Background_Image_Control class, which is a WP_Customize_Image_Control. I'd imagine offering these built-in backgrounds in a new tab alongside the existing Upload New and Uploaded tabs. There are at least two ways of achieving the following: either creating your own modified class based off of the ...


1

delete_post fires when the post is deleted permanently, not when it is trashed. I don't know if that is relevant but keep that in mind. That is the only real WordPress specific part of this question. The rest is bad PHP. Variables do not expand inside single quotes. You are a sending a query to the database that literally looks like SELECT `id` FROM ...


1

There are two mechanisms in WordPress that would fit your use case: custom taxonomies and post metadata. Since you have already determined that you want something close to mechanics to categories/tags (which are built-in taxonomies) it seems like custom taxonomy is a right fit for your use case. See register_taxonomy() documentation on creating it.


0

This is the query you're looking for: $args = array( 'post_type' => 'port', 'paged' => $paged, 'posts_per_page' => get_theme_option("portfolio_work_count"), 'category_name' => 'games' ); $wp_query = new WP_Query($args);


0

Codex has documentation on creating custom login pages - Customize Login Form > Make Custom Login Page, using wp_login_form() function. This should load everything necessary to log user in. However, unlike login, replacing admin would be much more involved and have many approaches. Typically to access admin function in non-admin context admin PHP files have ...


1

Modify the searchform.php, or create one in a child theme (recommended), and you should be able to modify the form all you want. This is the file that get_search_form looks for and is the file used by the default search widget, though it is not listed in the Template Hierarchy. Reference: http://codex.wordpress.org/Function_Reference/get_search_form


0

The meta boxes for the Appearance->Menus section are in /wp-admin/includes/nav-menu.php. The meta boxes for posts and pages are mostly in /wp-admin/includes/meta-boxes.php, if you need those.


0

I realised I didn't fully understand the link() function; now I realise that it links the control to the proper setting, making it problematic trying to point multiple controls to one setting. I modified my original function to instead add a hidden input that will hold my final value, along with the checkboxes. I then enqueued a small javascript that checks ...


4

Assuming you'd like the facility to update this data from the quickedit box whilst viewing the list of comments, you'll need a series of actions and filters. I've tried to make appropriate comments in the necessary places for you, though bear in mind i threw this all together for you with a small amount of testing(it does work though). This should get give ...


0

The reason you're having trouble here is that you're applying a universal filter to upload_dir. Rather than doing this, use a conditional filter for upload_dir after first checking ['mime-type'] for application/pdf. You need to intercept the upload process at the wp_handle_upload action hook and alter the upload folder there. What you have posted is ...


1

Simply check (in the loop): $loop->current_post: 1 == $loop->current_post AND printf( '<img src="/scripts/timthumb.php?src=%s&amp;h=90&amp;w=70&amp;zc=1" alt="%s" />' ,the_field( 'img_actor' ) ,get_the_title() ); You just have to change the Advanced Custom Fields API function to whatever outputs ...


1

If someone has a better solution, I'm open to it, however, what I came up with seems to work fine. Basically the following code is just waiting for the image to finish uploading and then hooking into the add_attachment action. Once the first is added, we hook in and then generate the new images via the post ID (for the image attachment) which is the only ...


0

If you take a look at the source code of this part … do_action( 'customize_controls_print_styles' ); do_action( 'customize_controls_print_scripts' ); ?> </head> <body class="<?php echo esc_attr( $body_class ); ?>"> <div class="wp-full-overlay expanded"> <form id="customize-controls" class="wrap wp-full-overlay-sidebar"> ...


1

Have a look in the source: http://core.trac.wordpress.org/browser/trunk/wp-includes/class-wp-customize-control.php Basic control types: text checkbox radio select dropdown-pages Also some advanced control types (as-described by Otto): WP_Customize_Color_Control - extends the built in WP_Customize_Control class. It adds the color wheel jazz to places ...


0

You can also redirect via WP. Yes, the htaccess variant is with better performance, but a small plugin is easy to use. Use the Hook template_redirect and check for the conditional function is_404(); if true, than get the right permalink and rewrite. Also you can use the small plugin Change Permalink Helper.


0

Create a sidebar $type . '_sidebar' Register the sidebar $type . '_sidebar' (e.g dog_sidebar) Pass the type as GET argument to the widget.php (create some menu entries or something else where you link to e.g. wp-admin/widgets.php?sidebar_type=dog_sidebar) Filter out every sidebar that should not be displayed. You can use this function: global ...


0

You should really Reset your post data like the examples in the codex Resetting Post Data Check out the wp_query function in the Codex for more info.


2

The function get_avatar's 3rd argument is the default image, which you can also pass a function's return value to, so wherever you run get_avatar in your theme you can set a function that changes the default avatar as a 3rd argument. get_avatar( get_the_author_meta( 'user_email' ), 64, 'http://example.com/path/to/image.jpg' ); Or, with a function's return ...



Top 50 recent answers are included