Tag Info

New answers tagged

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]


0

I had the same problem and I found and modified this function. It now does exactly what you want (redirect to a pretty URL): function redirect_to_pretty_url() { if ( is_singular() && !empty( $_GET['template'] ) ) { wp_redirect( home_url( "/my-question/" ) . urlencode( get_query_var( 'template' ) ), 301 ); exit(); } } ...


0

It seems your XML file not valid. Try to import another xml and check. If another xml imports then its 100% issue with your XML in which you are getting error.


1

You just need to add the styles directly to the page head. The best way to do this is to use the 'wp_head' action hook, assuming you are using a theme that has the hook. Like so: add_action('wp_head', 'my_custom_styles', 100); function my_custom_styles() { echo "<style>*{color: red}</style>"; } Check out the WP codex to learn more about ...


0

The php extension PHP GD was not installed on my dev machine. Installing php5-gd resolved this - sudo apt-get install php5-gd Stepping through using xdebug revealed that the theme's aq_resize function was failing at the following code: else { $editor = wp_get_image_editor($img_path); if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( ...


0

Is the html output to the page? If not, then the issue is almost certainly with your if statement. Should it be: if ( ( $show_thumb || $show_thumb !== '' ) && has_post_thumbnail() ) instead of: if ( ( $show_thumb || $show_thumb == '' ) && has_post_thumbnail() )


0

Some developers may want a root level folder for simple SFTP uploading and will allow their n00b clients to access that to add/remove images, pdfs, etc, but otherwise, all calls should be relative to the theme and not relying on structure/elements outside of the theme itself. More helpful reading here


2

You can use the callback argument for a completely customized rendering of your comment/trackback function wpse168639commentCb( $comment, $args, $depth ) { // do whatever you want in here: // Dump what you got: var_dump( $comment, $args, $depth ); } wp_list_comments( array( # other arguments... 'callback' => 'wpse168639commentCb', ) ...


0

The best approach IMO is to count the posts returned per page against the set posts_per_page option set in your query. If the count is less than the set posts_per_page, calculate the difference and then use this as the amount of posts to fill the rest in a custom query This is how it should work: First, count the amount of posts returned by your "main" ...


0

In your theme's functions.php file you can add add_image_size( 'thumb', 600, 350, true ); add_image_size( 'thumbnil', 600, 350, true ); add_image_size( 'medium', 600, 350, true ); add_image_size( 'large', 600, 350, true ); add_image_size( 'post-thumbnail', 600, 350, true ); add_image_size( '{custom-image-type}', 600, 350, true ); For more information ...


1

Use language_attributes(), it handles rtl and html or xhtml doctypes, and has a filter that users may want to hook in a child theme. You can see how they differ in source: language_attributes() get_bloginfo()


0

Get the answer here http://davidwalsh.name/remove-wordpress-admin-bar-css. Just add this function to your functions.php add_action('get_header', 'remove_admin_login_header'); function remove_admin_login_header() { remove_action('wp_head', '_admin_bar_bump_cb'); }


0

Yes, you can use those images having different sizes. When you upload an image, by default wordpress creates four images with different sizes like 50 X 50, 150 X 150, 300 X 225 and 500 X 500 and original size of image.So you can use any of them by following code : the_post_thumbnail(); // without parameter -> Thumbnail ...


0

Registered styles are in the $wp_styles global, and registered scripts are in $wp_scripts. You can var_dump them to see their structure. global $wp_scripts; echo $wp_scripts->registered['tt-easy-google-fonts']->src;


0

I'm experiencing the exact same problem, and it makes using the editor very difficult. I can only assume that it is a bug with one of the newer versions of WordPress in certain scenarios / configurations. Until it gets fixed properly my workaround is to wrap my enqueue statements in an if statement for !is_admin(). For example, in your case: function ...


0

Wordpress loads templates in order from most specific to least specific, depending on which templates files exists. For instance, lets say we have a wordpress page by name of "Audio Collection" with page ID of 14. WordPress would look for files by these names in order, and return the template for the first file name it checks that exists in your active ...


1

Yes, you can but you will get errors about the header already being sent unless you hook into init or admin_init (or elsewhere prior to the headers being sent). I haven't tested it, but you may be able to hook your session function into the send_headers action1 which seems like the most appropriate place since session is ultimately sending headers. On a ...


2

Sessions are basically useful for having data persist between pages. If you're using ajax calls, then you shouldn't need sessions at all, as you can easily pass parse/pass data on the fly, including other templates/files. On that note, WP has a built in ajax handling system. If you're unfamiliar with it, I'd suggest checking the WP codex. As for securing ...


0

anybody that looking for solution here is what i found that work for me. to get some data from any field in profile page you need to use this function: <?php get_the_author_meta( $field, $userID ); ?> then if you want to update some value in theme customizer you can use this function: set_theme_mod( 'field name', '$value' );


0

add_meta_box should be written on add_meta_boxes hook add_action( 'add_meta_boxes', 'myplugin_add_meta_box' ); function myplugin_add_meta_box() { global $slide_info; add_meta_box( 'new-meta-boxes-slider', __('slider Settings'), 'new_meta_box', 'slider', 'normal', 'high', array('inputs'=>$slide_info) ); }


0

follow the stackexchange they will explained how you are going to create a meta boxes. http://bit.ly/1vRnqnV you will get an clear idea about the custom meta box.


0

You cannot install plugins on wordpress.com. You have to create a WordPress Site with the software offered on wordpress.org. If you don't know how to install WordPress, I would recommend to choose a Managed WordPress Hosting like MyWoHo, Wpengine or Websynthesis. MyWoHo starts at 3$/month. It's not much, if you wanto to try.


0

This is how you can do it in Twenty Twelve themes header.php copied to a child theme. <?php if ( is_page('projects') ) : ?> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu' => 'conditional-menu-name', 'menu_class' => 'nav-menu' ) ); ?> <?php else : ?> <?php wp_nav_menu( array( 'theme_location' => 'primary', ...


0

You are not closing the second while loop. You'll probably want something like this: <?php /* * Template Name: Testimonials */ ?> <?php get_header(); ?> <div class="container"> <div class="content-page"> <h1><?php wp_title(); ?></h1> <title><?php wp_title(); ?></title> ...


0

This can be done a lot easier. It is just necessary to change the permalinks settings accordingly - as mentioned on github at the issue 3145: Meet this criteria: // If permalinks contain the shop page in the URI prepend the breadcrumb with shop if ( $shop_page_id && strstr( $permalinks['product_base'], '/' . $shop_page->post_name ) ...


1

It is no only name or email problem, as Tom wrote. I had problem even with input field with name attribute same as one of my Custom Post Types. For example: ... <input type="text" name="movie"> ... And when having registered CPT "movie" somewhere else, your form submitting will end with 404 error. Conclusion: Don't use name, email and any ...


0

To include posts from one or more specific categories, you can use and define category__in parameter in your WordPress query. Like this, here is an example. $args = array( 'category__in' => array( 11, 15 ), ); $my_query = new WP_Query( $args ); if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ...


0

You can use conditional is_page to define different menu items as you want. if ( is_page( 'About' ) ) { wp_nav_menu( array( 'container' => false, 'menu_id' => 'menu-left-side-menu', 'menu_class' => 'menu', 'theme_location' => 'about-page' ) ); } elseif ( is_page( 'Services' ) ) { wp_nav_menu( array( 'container' => false, 'menu_id' ...


0

Turns out the problem was with WP_CONTENT_URL, defined inside wp-config.php: define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/lab/WordPress-Skeleton/content' ); It seems that $_SERVER['HTTP_HOST'] is returning an incomplete path (only localhost without the folder). Since I'm using version control and using a local-config.php to define some ...


-2

<?php $args = array( 'smallest' => 12, 'largest' => 12, 'unit' => 'pt', 'number' => 0, 'format' => 'array', 'separator' => "", 'orderby' => ...


0

You can add custom fields to your posts and get it in sidebar. For add easy custom fields: Rilwis's meta box and for get its: $getted = get_post_meta($post->ID, 'custom_meta_name', true);


0

Okay so this will be your jQuery code. <script type="text/javascript"> $(document).ready(function() { $('.thumbup').on('click', function(){ $(this).parents('.entry').find(".hidden-like").toggle(); }); }); </script> But to use it, you will have to change couple of IDs in classes or you can also add classes ...


1

This sort of error that happens out of the blue like that tends to be related to the Database, so the only thing here that I could think of would be that your global $wp_rewrite got messed up by some plugin on something. Try to refresh your permalinks by going to the admin page: "Settings" > "Permalinks" and hitting save, I think this might solve your ...



Top 50 recent answers are included