Tag Info

New answers tagged

0

You could add a widget with the if ( is_user_logged_in() ) { conditional tag and add the HTML to a text widget.


1

You might wanna take a look at this: https://codex.wordpress.org/Template_Hierarchy Your index.php is typically the last file that Wordpress will look for when loading any page. In the case of the homepage, it will first look for front-page.php then home.php (if your home page is set to show latest posts, and not a static page). If you're changing the ...


2

First check that there isn't a page set as a front page in "Reading Setting". If that is set, index.php is not used as the home page, but the template of the page you set as front page. In that case, you need to find that template and add you conditional is there. <?php if(is_user_logged_in()) { get_header(); ?> <div id="primary" ...


2

There are no methods the_content() or the_title() of your query object. These: $review_query->the_content(); $review_query->the_title(); should just be the_content(); the_title(); If you had debugging enabled you would see an error informing you of this.


0

At first glance, I see that your query is calling for 'post_type' => 'page' while the taxonomy is registered on the post object type. Changing the post type to post ('post_type' => 'post') should fix the problem.


0

Why you are using this filter code, WordPress will still use searchform.php code, without it? Further, it could be some issue with the loop code within search.php. Twentyfourteen theme looks for content-[post-format].php file. Do you have one in you theme root? get_template_part( 'content', get_post_format() ); try using this simplified loop in ...


1

I wouldn't use custom page templates merely for changing the layout of the blog posts index. Using page templates for the blog posts index bypasses the core handling for display of the blog posts index (which per the template hierarchy uses either home.php or index.php to render). Edit I never...said that I want to change layout of the blog posts ...


3

You can disable certain themes in your WordPress network. Go to http://www.yournetwork.com/wp-admin/network/themes.php click on 'network disable' to hide the themes for the other websites. You can enable a theme for a single site by searching for the site -> click on 'themes' -> click enable at the desired theme. Hope this helps.


1

Edited Answer: TMG is a very popular auto plugin installer for WordPress and a lot of Premium theme author use it. You can get the php class here https://github.com/thomasgriffin/TGM-Plugin-Activation. Also when you will download it you will get a php file named example.php. You just have to include that example.php file in your function.php file and you ...


1

I could take advantage of get_template_part( $slug, $name ) and use it like: get_template_part( 'theme-options', get_current_blog_id() ); Say we are on blog_id 5, if theme-options-5.php exists it will be loaded. If not theme-options.php will be loaded as a fallback. Please note that get_template_part is using require.


0

Themes should not create content. Ever. That is plugin territory. When you activate the plugin, search for pages with a special custom field. Its name should start with an underscore, so it doesn’t show up in the Custom Fields metabox, for example _pluginslug_required_page. If there are no such pages, create your own. But I would question the underlying ...


0

Instead of using jQuery to update the value of the custom input, use the wp.customize object’s set() function (found in customize-base.js): wp.customize(key, function(obj) { obj.set(_new_value); } ); Where key is the setting, and _new_value is the updated value. Also, worth noting, in the class that extends WP_Customize_Control, make sure to use ...


0

Deactivate the current theme (ie. activate a different theme, say TwentyFourteen) and then reactivate your theme. When a theme is activated WordPress goes through some initial set-up of relative uri's, etc. and there are sometimes cases (particularily new theme development) where WordPress does not run that initialization code. Deactivating and ...


3

This sounds like a description of the JetPack's Photon service. Photon is an image acceleration and modification service for Jetpack-connected WordPress sites. Converted images are cached automatically and served from the WordPress.com CDN. Images can be cropped, resized, and filtered by using a simple API controlled by GET query arguments. When ...


1

The hooks you are looking for can be found in the WordPress Codex WP_Query - Filters: Filters posts_distinct - Alters SQL 'DISTINCTROW' clause to the query that returns the post array. posts_groupby - Alters SQL 'GROUP BY' clause of the query that returns the post array. posts_join - Alters SQL 'JOIN' clause of the query that returns the post ...


0

Ok, I fixed the issue. I noticed that if I went to any of the other pages, the theme showed up fine, but if I went to the home page, it was rendering the Asian characters. I noticed that in my home page template file there were two NUL charactares that had apparently slipped into the file: I do not know how they got there, but once I deleted them, ...


0

The first thing to check with a 'headers already sent by...' error is that you have no white space at the very start or the end of your php file. Check your images-options.php file and remove any errant space at the very start or the end of your code.


0

if you are asking default background image for add_theme_support( 'custom-background'); then it can be set using 'default-image' => get_template_directory_uri() . '/images/pattern.png', complete code will look like below. $args = array( 'default-color' => 'f0f0f0', 'default-repeat' => 'fixed', 'default-image' => get_template_directory_uri() ...


0

I think the wholee problem is your trying to use the default walker, but by declaring it in the walker field your telling wordpress your trying to load a custom walker, the wp walker is loaded by default if left empty. two options: 1/ change 'walker' => new Walker_Nav_Menu() to 'walker' => '' as its called by default. 2/ edit declaration to a new name ...


1

It is definitely possibly to create 3 (or more!) layouts within a WordPress theme. It all depends on your skill level and comfort with PHP and WordPress if you can do it yourself. WordPress allows for creation of multiple page templates within your theme (http://codex.wordpress.org/Page_Templates#Creating_a_Page_Template). WordPress also allows for ...


0

After looking at the previous answers, I think I fixed the problem Cmorales identified with sanchothefat's answer. Define your widget as follows: register_sidebar( array( 'name' => 'Sidebar', 'id' => 'sidebar', 'before_widget' => '<div class="panel panel-default %2$s" id="%1$s">', 'after_widget' => '</div>', ...


3

When you pour some water into a glass, first you put the glass on the table, then you turn the bottle. If you first turn the bottle, and then put glass on the table, your floor gets wet and your glass stay empty. Actually wp_enqueue_scripts is just a way to save a variable (water) inside a global object (glass), so before to call the function (turn the ...


0

The first line is just an HTML comment outside the scope of PHP. It'll output with every response and creates all the kinds of headaches you're experiencing. Solution? Remove it, or make it a PHP comment: <?php /* In a child theme, all of the functions of the parent theme are present, unless overridden here */ You should also make sure there's ...


2

It is required, actually. There's no real difference between themes and plugins as such. Neither of them should take actions on merely being loaded, they should use action hooks on functions to have things happen in the correct ordering.


1

Take a look at the parameters in the documentation of wp_list_categories() function. You need to use this parameter: title_li (string) Set the title and style of the outer list item. Defaults to "Categories". If present but empty, the outer list item will not be displayed. See below for examples. I think it's clear, you just need to pass this ...


1

What I would do is create a parent theme that is used on one site and a child theme of that theme for all other sites. In the parent theme's header a you would do a regular wp_nav_menu() call to build your menu, except you wouldn't echo it. Instead return the menu into a variable, pass that to update_option and then echo it. In your child theme's ...


1

Here's an example that "abuses" the tag description field to store a template name for the tag. We use the tag_template filter to get the tag description if it exists and include a template file with the description as part of the name. You could extend this to whitelist specific template names so typos don't result in trying to load a file that doesn't ...


2

You can use tag.php for the great number of tags and use tag-{slug}.php for remaining ones. Also, you can use conditional tags for all in one file, tag.php: if ( is_tag( '{tag-one}' ) ) { // only for tag with slug "tag-one" } elseif ( is_tag( '{tag two}' ) ) { // only for tag with slug "tag-two" } elseif ( is_tag( '{tag three}' ) ) { // only for tag ...


1

It seems you need a seft-closing shortcode. http://codex.wordpress.org/Shortcode_API will be a great read to get started.


4

You want to define a potentially huge number of different shortcodes with the same shortcode callback? Why don't you define a single shortcode, with a term attribute? For example [sc term="london"] ps: I think your problem lies in the $tax_term->name part, which could be a string like City of London and that's not a valid shortcode name. Try ...


0

Designing in plain 'ol HTML and CSS could make easier. However, there are many features of the WordPress framework that you'll miss out on. Read some of the WP documentation in the Codex to begin with: https://codex.wordpress.org/Site_Design_and_Layout I will also draw your attention to the body class attribute, which I find extremely useful when ...


0

All the post meta you're saving is being attached to a post of type attachment, so in this case $post->ID is the attachment ID.


0

"Attachments" aren't meta data. That is why you can't retrieve them with get_post_meta(). "Attachments" are a post type that is attached to the parent post. You need to pull the attachment posts that have you post set as parent, and then use those IDs to get the attachment meta. $args = array( 'post_parent' => $post->ID, 'post_type' => ...


0

Looks like it is a privilege thing: Adding those tags as an admin works, while with other users having less privileges (editor, etc) does not.


0

No, you cannot include PHP files in a theme the way you indicated. To see why, all we have to do is exercise some common sense and basic critical thinking: You would be doing a remote request to a remote server include cannot do this If by some miracle it worked, you would have a major security exploit as I could then do something like this: include( ...


0

Have you tried using 'single' instead of 'multiple'? (I guess the display of 'multiple' is a bit misleading. In your example I think the first / is a marker for the hiearchy. The second / is for dividing alternatives.)


1

If you select both categories for the post the_category() will display both and using multiple will make the child category display the parent relationship, so you will have the parent twice. If you want to display a link to the parent category and a link to child category select only the child category for the post and use the_category(' / ', 'multiple');. ...


0

I contacted GoDaddy support and they advised me to login to the hosting manager and make the edits to the functions.php file from there. That way it worked ! Though i still couldn't figure out why i was getting that problem when i tried to edit it from within my WordPress dashboard, but anyways the problem is solved now. Thank you @ialocin and @s_ha_dum ...


2

The stylesheet is registered and enqueued by a function called twentyfourteen_scripts() in the theme's functions.php. Callbacks hooked into the style loader/dependency system will be echoed on the wp_head action in the wp_head() function. Which, by the way, is how you should be loading your own stylesheets. There is a similar system for scripts.


1

You are already pretty close. Extending your example: In your plugin put this: $default_settings = array( 'key_one' => 0, 'key_two' => 1 ); $settings = apply_filters( 'example_filter', $default_settings); Then a theme can change it like this: add_filter('example_filter','my_function'); function my_function($settings){ $settings['key_one'] ...


1

Try this function cat_loop ($key){ $fashion_cat = array( 'category_name' => $key, 'posts_per_page' => 4, 'post_type' => 'post', 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC', 'post__not_in' => $already_posted, 'category__not_in' => ...



Top 50 recent answers are included