Tag Info

New answers tagged

0

That is pretty easy to do with WP's login_redirect filter. A small snippet like this added to your functions.php file would do it: /** * Return the url you want to redirect to after login. * This example redirects the user to the main page. */ add_filter( 'login_redirect', 'my_login_redirect' ); function my_login_redirect( $redirect_to ) { return ...


1

It depends on the theme. Most themes provide a composer (like Visual Composer) to adjust page content. If your theme doesn't work with a composer, you have to change the server files. Take a look at the child theme workaround then.


0

If you have done the first part correctly in loop-home.php, you can just simply move that into the appropriate template used by your archive pages. Taken into account that you have not used custom queries to build your queries on the homepage or any of the archive pages, you can do the following which will work on any of the aforementioned pages Use the ...


0

There are many options, but these functions are your friends: wp_insert_post - pass it some arguments and it will create a post and if succesful, return the post ID wp_set_object_terms - pass it a post ID, a custom taxonomy, and the terms you'd like to set fopen - for opening a csv file fgetcsv - reads in a single line from a csv and returns it for ...


0

You should really re-title this question and refine your question further. From what I gather you are actually trying to find out how to add posts to your custom post type that has custom fields via a CSV. My suggestion is to look for a plugin that imports posts from a CSV and either find one that already has a column for post_type and columns for custom ...


0

I was able to resolve this issue without using a separate theme or subdomain. I have elements of my theme that are loaded/not loaded on the server side based on the user agent (mobile/not mobile). After installing and enabling some basic caching with W3 Total Cache, I was getting desktop elements on mobile or vice versa. In W3 Total Cache User Agent Groups ...


0

I don't want to repeat the coding options since they have been exhaustively covered, the other option I know that works is using a plugin that hides wp. I have used this plugin before to satisfactory standards. Its called hide my WordPress.


0

The problem lies in your soto_user_meta_box_save function. This function is tied to the save_post action, which means it will fire whenever any post of any post type is saved, not just your custom post type. You need to add a check inside this function so it aborts when testing the wrong post type: function soto_user_meta_box_save( $post_id ) { // ...


0

If you're using Yoast's SEO plugin, you can set a default image for Facebook shares from the WordPress backend.


2

As you have already understated, running executable PHP inside a text box is not a good idea. It isn't only just not a good idea, but a terrible idea. This creates a loop hole in your security which can be very easily exploited by a hacker. I would suggest writing your own custom widget for this functionality. It is really easy adding a custom sidebar to ...


1

The PHP Code Widget does not modify the Text or Visual editor box, or the standard "Text" widget; it adds a "PHP Code" widget, which you'll find under Appearance > Widgets > Available Widgets. If you want to display your script within the body of the post or page, you should create a Shortcode. The basic example from the API would work for "Hello World"; ...


3

You can use is_paged() ...checks if page being displayed is "paged" and the current page number is greater than one. This is a boolean function, meaning it returns either TRUE or FALSE. You can adjust your code as follows <?php if( is_home() && !is_paged() ) : ?> <p>Some text</p> <?php endif;?>


1

You could do this with jquery. I have a similar code on use which you could probably easily edit to your needs: load the admin js (I load css too but you can remove that) function wpse181868_admin_css_js() { wp_register_style( 'bones_admin_css', get_template_directory_uri() . '/library/css/admin.css', false ); wp_enqueue_style( 'bones_admin_css' ...


0

If I understood correctly you need to show a specific category index on a page template, right? If that's the case you can use WP_Query: <?php /* Template Name: My Page Template */ ?> <?php get_header(); ?> <!-- If you want to retrieve the page title, content, ... --> <?php the_post(); // set up the post ?> <h1> ...


0

You have two options. Either use get_field or the_field. get_field just reads out the field from the db without and screenoutput. like you did in your first line: $fields = get_field('testimonial'); the_field instead is get_field with an implied echo. <?php the_field('testimonial'); ?> so basically the_field would be enough. Aside you have to ...


2

The question was for Wordpress 3.0, but just in case someone has the same question for a more recent version, from Wordpress Codex: "Starting with version 4.1, meta_query clauses can be nested in order to construct complex queries." http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters So that query should work on the current ...


0

Figured it out, you have to create a new class extending WP_Customize_Control: // Add Layout setting $wp_customize->add_setting( // ID 'sidebar_left_selection', // Arguments array array( 'default' => 'none', 'sanitize_callback' => 'webcodexcustomizer_sanitize_sidebar_selection' ) ); class ...


0

After a bit more research, I have found a way to do this from this post http://wordpress.stackexchange.com/a/136064/54989 Rather than using unset as I had done previously, remove_menu_page works for Duplicator: remove_menu_page( 'duplicator' ); so my complete code now looks like: function jitb_remove_admin_menu_items() { if ( !current_user_can( ...


2

Figure out a way to create multiple different custom post templates for an end-user. That is, have predefined regions that they can insert content within a post. You can do that with custom fields / meta boxes, which you can restrict or display based on post-type or ID. You should try the Advanced Custom Fields plugin. Or lastly, is there another ...


0

Given the way categories & tags are setup in WordPress this would not work from a logical standpoint. The issue here is that tags have no way to be connected directly to a category, they are mutually exclusive from each other. The subcategories would work because a subcategory is directly related to is parent category but tags are non hierarchical and ...


1

From what I can understand, you are talking about a static front page as you are referring to a template called homepage.php. The standard homepage uses index.php. To achieve 3 latest posts, you will need to create a custom query using WP_Query. I'm not sure which parameters you need, but feel free to read throught the given link and just add them as ...


1

You'll want a post type of type book, with a custom taxonomy for the publisher series. Use post meta for the books data. The UI will be provided by Core As a refresher: Things/objects/entities are post types We classify things using taxonomies. If you can filter by X, then X is a taxonomy, e.g. colour, type, size, shape, manufacturer, etc Attributes that ...


0

Two issues here Never use extract(). It has been removed from core functions, that should tell you a lot. For more info, check this trac ticket #22400 Your tax_query is incorrect, it should be an array of an array, yours is just an array Your shortcode should look something like this function course_listings( $atts ) { // Attributes $defaults ...


0

To get posts that belongs to all selected categories, you can make use of the category__and parameter. Example: You can the following to your query arguments, this will only display posts that are in category 1 AND 2 'category__and' => array( 1, 2 ),


0

You can use the_terms function in WP to display your term values in your archive page. Usage the_terms( $id, $taxonomy, $before, $sep, $after ); Parameters $id (int|req) -> Post ID. Default: None $taxonomy (str|req) -> Taxonomy name. Default: None $before (str|opt) -> Text to display before tags are displayed. Default: Empty string $sep (str|opt) -> ...


0

(I can't comment for being 50- reputation) I didn't understand your problem well. Choose or tell us; 1) Your post content have links and you want to add nofollow to links in custom fields which already used in content 2) You're writing your custom field's value already but just want to add nofollow. or tell us your scenario Update <a href="<?php ...


1

This is something you cannot change in the field it self, but in the template file. Copy and paste here the template file where this option is outputted. Another way will be to add a javascript snippet to you head, if you have such option in you template. Comment here and we'll see what the best solution is. Update: I think best solution for you is to ...


1

This will do what you want, and both functions should be placed within your fucntions.php file. The my_random_string() function accepts arguments, so you can add data before/after the string, as well as change the length of the string and the characters that are used to generate the string. /** * Generate a string of random characters * * @param array ...


2

Just FYI: After struggling for hours, I found the aswer. The line that was causing the problem is the following in my wp-config.php file: define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/'); It turned out my WP_SITEURL is not working correctly because I changed the directory structure as described in the question. So I modified wp-config.php ...


0

So far i know google appreciate a single instance of h1 tag in a page, but it could be anywhere at the priority content area. And all of WordPress front pages does have an element to use inside h1, such as post title, category name, search text, author name etc. Usually Blog or Front page doesn't have a Headline or title. So you could try adding it for the ...


1

It's doable with a user agent string "sniffer". Take a look at this project: http://mobiledetect.net Mind you, this approach can be troublesome as most modern browsers can 'fake' their user agent strings. Also, this approach doesn't work to well with caching systems. I've implemented it successfully on a project I worked on, and I know it's possible but ...



Top 50 recent answers are included