Tag Info

New answers tagged

0

when outputting you can use strip_shortcodes( $content ) which will remove all shortcode tags from the given content.


0

Whatever type of cache mechanism you're using, look closer at it. Look for something that says "Flush" or "Clear". Click that.


0

You can use the $_SERVER['HTTP_REFERER'] to check the page where it redirected from You can use it as below. if($_SERVER['HTTP_REFERER'] == "path-of-page-you-want-to-check"){ //Do something here } Conditionally you can call functions like is_home(), is_front_page() to run that block of code in homepage only


1

The problem, as idiotic as it may seem, was that I had inadvertently included the template name of my standard subpage template into my landing page template. WP didn't know what to do with it...


1

You can do this by adding the following class in your theme for admin options; Custom-Metaboxes-and-Fields-for-WordPress And you can call your repeatable fields with some thing like this; array( 'name' => 'Name of field', 'id' => 'prefix_option_name', 'type' => 'text', 'default' => '', ...


2

Using after_switch_theme will activate the theme (which is fine as we want to run the check within the context of the new theme). So if the check fails, we can simply switch back to the previous theme (passed via after_switch_theme as $oldtheme). If WPML is missing ($wpml_is_missing = true;) we will output an admin notice and switch back using ...


0

kraftner is probably right but I recommand you to stop using global $post. I mean it's not bad but there are often issues with this big array that can be modified by almost everything running on the wp install. So to me it's not very safe. I prefer using get_queried_object() and it works quite the same way : $parent_ID = ...


0

I assume you haven't globalized $post before using it: global $post Have a look at the Codex if you need more detailed info.


0

You can style a link as a button with the button css class: <a href="#" class="button">I am a button</a> You can modify a button with the primary styling by adding button-primary: <a href="#" class="button button-primary">I am the primary button</a>


1

So, yes, WP can be quite a mess, more so in complicated themes. Some of it is just experience and chewing through sources. There are, however, several things that can help to determine what is happening via code: Dumping get_included_files() will get you all PHP files loaded up to that point. It's messy, but sometimes it's what it takes. There are plugins ...


0

i think you're putting too many extra bits on the file and path strings. try this : function _s_scripts() { $js_dir = get_template_directory_uri() . "/js/"; foreach(glob($js_dir.'*.*') as $file) { $label = str_replace(".", "", $file); wp_enqueue_script($label, $file , array('jquery'), '1.0.0'); } } add_action( 'wp_enqueue_scripts', '_s_scripts' ); when ...


0

Hey Change Callback function to like this and add_meta_box to add_meta_boxes hook function create_meta_box_slider() { add_meta_box( 'new-meta-boxes-slider', __('slider Settings'), 'new_meta_box', 'slider', 'normal', 'high' ); } add_action('add_meta_boxes', 'create_meta_box_slider'); function new_meta_box() { global $meta_box_groups; ...


2

Code is not readable in comment so I am adding it here. With a little explanation. You will need to add full path of the image file to show them in theme. If your image is in theme directory then you will have to use theme directory path variable bloginfo('stylesheet_directory') with image name. So this is the code you will need to add in your theme files. ...


0

In case someone finds this someday I was able to solve this and I used tis walker: class Navigation_Catwalker extends Walker_Category { // Configure the start of each level function start_lvl(&$output, $depth = 0, $args = array()) { $output .= ""; } // Configure the end of each level function end_lvl(&$output, $depth = 0, $args = array()) { ...


0

Hey by using enqueue script to add all js and css file wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); Example here /** * Proper way to enqueue scripts and styles */ function theme_name_scripts() { wp_enqueue_style( 'style-name', get_stylesheet_uri() ); wp_enqueue_script( 'script-name', get_template_directory_uri() . ...


1

By Using add_theme_support( $feature, $arguments ); Support for the gallery and caption Example add_theme_support( 'html5', array('gallery', 'caption' ) ); Source: http://codex.wordpress.org/Function_Reference/add_theme_support


1

try and add your location as a parameter. <?php if ( has_nav_menu( $location ) ) { //Do something } ?>


1

TL;DR: The only "unit" tests most themes will need are these. There is actually a very good reason that most material is on plugin unit testing. Themes really aren't good candidates for unit testing. A theme is usually mostly concerned with how your site is displayed, and that is something that you can't really unit test. Yes, you can check the HTML ...


2

PSD files are typically included with premium themes as an extra to allow you to customize the image assets. You have to open those files in Photoshop, edit them, and export new versions to replace the png, gif, or jpg assets that came with the theme. There's nothing in WordPress core that deals with PSD files, and the specific details of how the PSD files ...


1

You're already on the right way; just add another loop for the $parent_terms array around your existing loop. Also it might be a good idea to check if the numbers in the array are valid term IDs, so you might end up doing something like this: $parent_terms = array( 1, 2, 3, 10 ); $taxonomy = 'products'; echo '<ul>'; foreach ( $parent_terms as ...


0

Each WP menu item that contains a submenu haves the "menu-item-has-children" class for <li> you can use that class for add a pointer for sub menu: For example the simple example can be this but you can use that for creating better pointer for your site: .menu > li.menu-item-has-children > a:after{ content: "(have child)"; }


1

Try this: add_theme_support( 'html5', array( 'gallery', 'caption' ) ); And don't forget to declare the HTML5 DOCTYPE at the very beginning of header.php with: <!DOCTYPE html>


1

You can use wp_add_inline_style to attach some css to dashicon style. Using that function everytime you add dashicons css via wp_enqueue_script you can automatically append some css and so modify default styles. Something like: add_action('wp_enqueue_scripts', function() { wp_add_inline_style( 'dashicons', '.dashicons { ...


0

I took a look at Bootstrap's Glyphicon CSS and WordPress's Dashicon CSS and formulated a tweak. Bootstrap Glyphicons CSS .glyphicon { position: relative; top: 1px; display: inline-block; font-family: 'Glyphicons Halflings'; font-style: normal; font-weight: 400; line-height: 1; -webkit-font-smoothing: antialiased; ...


1

You can use em sizing to make the dashicons scale relative to the font size of their containing element. This should do the trick: .dashicons:before { width: 1em; height: 1em; font-size: 1em; } Then if your <h1> element has a font-size of 48px, your dashicon will as well.


0

As I mentioned in my comment, the dashicons are meant to be part of the dashboard menu, as such they are sized very specifically: .dashicons-before:before { display: inline-block; width: 20px; height: 20px; font-size: 20px; line-height: 1; font-family: dashicons; text-decoration: inherit; font-weight: 400; font-style: ...


0

step 1: Create or copy content-single.php and create a new file. eg: content-yourCategory.php step 2: Open single.php and replace this get_template_part('content','single'); by the following code if(is_category('yourCategory')){ get_template_part('content','yourCategory'); }else{ get_template_part('content','single.php'); } The ...


2

From my comment to the OP My opinion, use what you are comfortable with. If there are any performance difference it will be minute/irrelevant. My preference, use the filter To come to your real concern/question, in my opinion, the best approach will be to use the parent category ID and work from there. It will be the least resource intensive to work ...


0

This is likely related to a problem with the plugin itself, or a conflict with another plugin. The other thing to check would be that your .htaccess file exists and is writable by WordPress. Permissions of 644 are what is recommended see this codex entry. Ownership of the .htaccess file would generally need to be the apache user (sometimes this is www, on ...


6

WordPress has a embedded feature for handling maintence mode. When you upgrade a plugin or WordPress core from WP dashboard, WordPress enter maintenance mode: it tries to load a file named maintenance.php located in content folder (usually /wp-content), if that file is not there WP shows a default message. I suggest you to use that file, in this way you be ...


-2

Better thing is that if you have all pages in html format of you current site , following will help you to convert html to wordpress as per your given partition : http://www.wpexplorer.com/create-wordpress-theme-html-1/


-2

Zend's Z-Ray has a theme profiler. Also useful for seeing SQL queries.


0

You can put the following code by @bainternet just after the register_post_type('authors', $args); line, and it will flush the rewrite rules and may be you can have a solution. /** * To Activate Custom Post Type Single page * @see http://en.bainternet.info/2011/custom-post-type-getting-404-on-permalinks */ $set = ...


0

I checked it with create the Authors Custom post type. I just changed the permalink structure post name to default and again default to post name. Its working fine. you can try it, and let me know if you have still facing this issue.


0

Each theme has difference "theme location", so when you change the theme, the "theme location" will change too. That mean there is no way you can hard code those menu to "theme location". (That's all I know)


0

You can do this with the WordPress tools, without POEdit. First, do an svn checkout of http://develop.svn.wordpress.org/trunk/: svn co http://develop.svn.wordpress.org/trunk/ wpdev Then, switch to the i18n tools directory in it: cd wpdev/tools/i18n/ Then just run the makepot.php over your theme's directory: php makepot.php wp-theme /path/to/your/theme ...


3

Here is how you can create a .pot file for your theme with Poedit (free edition, version 1.6.10) on OS X. Best practise is to save language files in a folder named "languages" in your theme directory. If you haven't already, create it before you start. In Poedit: In the "File" menu select "New" Select the language that you used in your theme (probably ...


1

Your should add rewrite endpoint template on theme activation hook and init hook. Also there is some little checks to perform to prevent errors. function sjc_theme_activate(){ sjc_theme_add_rewrite_endpoint(); flush_rewrite_rules(); } //for more info http://codex.wordpress.org/Plugin_API/Action_Reference/after_switch_theme add_action( ...


0

Instead of that try using; <?php get_userdata( $userid ); ?> For example; <?php $user_info = get_userdata(1); // get info for user id '1' $username = $user_info->user_login; $first_name = $user_info->first_name; $last_name = $user_info->last_name; ?> For more details visit this link.


0

Got it. This post demonstrates what I need.


0

Yes, it is typically possible to re–create arbitrary markup in WordPress. However the difficulty of the task varies from easy to highly challenging. Sometimes it is easier to bend to markup WordPress gives you, than bend markup to precise state. For navigation menus there are basically two levels of control over markup: As per wp_nav_menu() documentation ...


0

Now I know what was the issue. I had the filter by category activated in Isotope settings: filter: '.front-page-tiles' :)! so regular items not in that category was being correctly hidden by Isotope


0

You can also rewrite URL using htaccess, it can also redirect to a pretty URL. Just put this code into your .htaccess file. RewriteEngine On RewriteRule ^my-question/([^/]*)$ /my-question/?template=$1 [L] Or You can also done it with functions.php using following code snippet. global $wp_rewrite; add_rewrite_rule('^my-question/([^/]*)?$', ...


0

Update: I've come to realize that we have different goals... @NewUser accepts that both URL styles work: http://example.com/post-title/?template=basic and http://example.com/post-title/template/basic. While my goal is to never see http://example.com/post-title/?template=basic, by having it redirect to a pretty URL. Just like domain.com/?p=100 redirects ...



Top 50 recent answers are included