Tag Info

New answers tagged

1

As Pages are a special built in Posttype, they get an own template hierarchy. Other "normal" post types and custom post types can only be templated by "single-$posttype.php". You can however hook into the single_template filter and make wordpress redirect to your template file: function get_custom_post_type_template($single_template) { global $post; ...


0

I just got this working last night using the above code (and the extra comment) and there are a few things I'd like to add here. First, in the "To get the PDF" section, 'wpcf-brochure' should be changed to 'wp_custom_attachment'. Next, to answer the final question from OP, to make it appear in the back end, here's the technique I used. Before the line ...


0

I think the best way would be to store the complete date-time in one meta field, saving it as an timestamp in the metafield and converting it by php datetime object functions for displaying. Step 1) Create a Metabox with a text input for entering the date + time. You can find a good introduction to meta boxes here: ...


0

You can try modifying your query using pre_get_posts filter. function mod_query() { if ($query->is_main_query() && !is_admin() && is_search()) { // test print queried search terms print_r( $query->query_vars['s'] ); $search_terms = $query->query_vars['s']; $search_terms = preg_replace('/\s+/', '+', ...


0

@brasofilo is nearly there but there is a better way to do this. Goto your theme folder and create a folder called 'theme-my-login'. Copy any file from the theme-my-login/templates folder into this new folder. The plugin will first check the theme's folder and then the template folder. This is standard practice in WP for dealing with template files. EG. ...


0

Use add_action( 'save_post', 'shortend', 999); and put this in your function as first. if ( 'project' != $_POST['post_type'] ) return $post_id; If this doesn't work then you should echo $_POST; and see if kaart_verkoop is part of the array.


0

Easiest thing you can do is make it a anyname.php and wrap this tagline in it. <?php Template Name: Index ?> <html>elements within it</html> In WordPress go to any page you create and choose template name: Index. From WordPress go to Settings > Reading and choose the custom page you want. This will avoid bad seo practises and keep you ...


0

You could use wp_redirect <?php wp_redirect( 'http://www.example.com/your-page/', 301 ); exit; ?>


1

Put the code from the index.html page into a file called front-page.php and put that in your theme directory.


0

Would you mind if I just leave bread crumbs so you can solve this pazzle ? add filter 'query' hook $wpdb->prefix & local wpdb prefix value somewhere in *_options table remove_filter show values Once one wpdb instance declared... you can reach any table in it (beware I said table in one DB). But you can't do what you actually doing right now. YOU ...


1

No, there should be no issues running multiple multisite installs in a single VVV setup. I have at least 4 multisite installations running on my machine as I type this. Your issue is likely either because your multi-sites are identical, and share database tables and/or URLs, or, you've added a subdomain site and you now need to re-provision VVV to get the ...


0

I agree with Pat above - I'd say from my own experience it probably helps in the long run making a Custom Post Type for houses to keep hundreds of the things separate from your main pages (or blog). For starting with coding it all - sometimes to kick off with and starting to learn about these things it will give you a headstart to begin with plugins. I ...


0

The main query that runs on archive pages are quite specific to archive pages, and this query is not replicated with a default custom query. As your code stands, your query will retrieve posts according to published date, ie from newest to oldest, and not according to archive. THE PROBLEM There are a couple of issues here that I would like to point out. ...


2

Use below code for getting post format, simple made condition if post format ="standard" then load your preferred template $format = get_post_format(); if($format ="video") { get_template_part( 'format', $format ); } Something like this.


1

Just create an array with your classes and loop through alongside with the main loop: function custom_top_products() { $classes = array( 'first', 'second', 'third', 'fourth', 'fifth' ); $classes_count = count( $classes ); $posts = new WP_Query( array( 'post_type' => 'products', 'post_status' => 'publish', 'orderby' ...


0

Did you post the correct name for the taxonomy template? I think it should be ' taxonomy-listing_category.php. See Custom_Taxonomies_display Or are you including it some other way? With new WP_Query you're not using the default query which has the query variables for the taxonomy and term. You can however add the taxonomy and it's term back to the queries ...


0

Combining two methods here: $args = array( 'post_type' => 'attachment', 'numberposts' => null, 'post_status' => null, 'post_parent' => $post_id ); $attachments = get_posts($args); if ($attachments) { DELETE FROM wp_postmeta WHERE post_id IN ( SELECT id FROM wp_posts WHERE (post_type = 'book') ) ; } }; then: DELETE FROM wp_posts WHERE ...


0

This is actually quite possible, however, there are some specific things that you need to do to get it to work. First, create a file on your wordpress installation that currently has that menu, for the demonstration, we're calling it myoutsidermenu.php, in a theme called theme_name. Once you are done that, edit the php code so that it echoes your menu item ...


0

Working with raw data is always a bit dirty. The clean approach to do that would probably be to implement an own widget, that does exactly what you want it to do. You can learn more about using the Widget API here: http://codex.wordpress.org/Widgets_API There are also some great examples there. Not that hard to understand. To start off, you can basically ...


0

To modify the menu, you mainly will use the menu walker class. See here http://codex.wordpress.org/Class_Reference/Walker for a basic example. Menu walker is not very self explaining, so you might consider simply writing your own PHP code, directly querying the database, if you feel comfortable with PHP. Another and the most simple methode might be to use ...


0

If the main "container" with your content starts at the end of your header.php, then yes, that's the right place to put your widget container code. This seems to be more of a CSS layout issue rather than a wordpress one. Take a look at absolute positioning on your elements, and it might take some playing around, but I'm confident it will yield the results ...


1

As @Michelle rightly pointed out, blog.php is not part of the template hierarchy. Here is what the codex have to say about Custom Blog Posts Index Page Template To create a custom blog posts index template, include the following in the Theme: home.php Use only the home.php template file for the blog posts index. Do not use a Custom Page ...



Top 50 recent answers are included