Tag Info

New answers tagged

0

Add this in your functions file and it links all single posts within the same category add_action('loop_end', 'wpsites_nav_links', 25 ); function wpsites_nav_links() { if( !is_single() ) return; previous_post_link('<span class="single-post-nav previous-post-link">%link</span>', '&lt;&lt; Previous Post in Category', TRUE); ...


0

I think you can simply just echo your variables. You have set up your variables, but are doing nothing with them, hence you will not get any output. Simple echo $post_prev; echo $post_next; should do it. You can also have a look at get_adjacent_post for other working examples


1

Finally figured it out. Using the plugin mentioned above (linked here for ease) and the basics of the answer to this question I was able to cobble together this code It's a bit hamfisted, I'll admit that (mainly replacing the preg_match with strstr) but it got the job done. I'm open to any improvements you all can think of so please feel free to comment ...


0

I'm not aware of a theme that does this - there very well could be one but I just don't know about it. There is a membership plugin that can be setup to require all users to login before seeing anything by Justin Tadlock called Members. It also has the ability to block content for users etc. If you want to do it with code, auth_redirect() will check for a ...


0

Have a look at the wordpress codex http://codex.wordpress.org/Function_Reference/is_user_logged_in and http://codex.wordpress.org/Function_Reference/get_currentuserinfo. Happy Coding, Kuchenundkakao


0

I've faced this issue many times in my Wordpress development. Simply follow these steps: Download the codes and files using FTP FileZilla or WinSCP (only on Winndows) or if you're having shell access then try to first compress the whole bunch of files it a tar.gz or zip and then download the single compressed file. Download the DB carefully, remember to ...


0

The web hosting provider should have a process available for gaining access to a control panel, FTP, etc. They will likely need your employer to prove ownership of the account somehow. From this access, you will have all that you need to duplicate the site and install a development version before beginning your edits.


0

That is perfectly valid HTML and you don't have to do anything to support it. It has no bearing on HTML 5 or not.


0

See the following related answers. Don't quite know what you mean when you say doesn't support html5. I'm guessing you see it raises a flag on some validator or another. Html5 supports it. Answer One Answer Two


2

Nothing. A theme_name_setup() function should not even exist. The name is too vague. What does setup mean? This is also the root of your question, because such a name tells us nothing about what the function does. Could be anything or nothing at all. Technically, themes don’t even need a functions.php. But they work, the setup happens by WordPress. It ...


0

Try Advanced Custom Fields and simply add a WYSIWYG editor. Step 1 Et Voila! Displaying the input on the front-end <?php /* Put the attachment ID in place of 999 */ // Display the_field('yea', 999); // In case you need to don't want to display it right away get_field('yea', 999); ?>


0

You can use get_queried_object to return the name of the current category page you are on $cc = get_queried_object(); echo $cc->cat_name; //display the name of current category page


-1

You should encode the array to json or serialize it before adding it as an option: add_option('bguru_options',json_encode($default_options)); or add_option('bguru_options',serialize($default_options));


0

I think that you have added bguru_options option before. If bguru_options already exists, add_option() does nothing. To modify the value of existing options you should use update_option() instead. EDIT I confirm what I thought. You are running add_option('bguru_options', $default_options); in every admin_init. bguru_options option was added to database in ...


0

try get_stylesheet_directory_uri() http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri Using this has helped me with this type of issue in the past.


0

H'okay, so, using this resource, I was found that going into the template-knowledgebase.php file and replacing the cat keyword with category__in (that's a double underscore) did only return the articles who's parent were the category we were looking at. I also edited the else statement of the if to be endif and removed the extraneous endif. This is what my ...


0

As long as there have been no changes to the live since since you took the backup of it to work on in your dev environment, then yes you can replace the existing database with yours. You do not need to activate the new theme on the live server - the currently active theme is stored in the database, which you will be overwriting with your database backup ...


2

Since this is the 1st hit on google for this question, I feel this is the right place for an update: For me, I couldn't get it to work via edit_theme_options. Then I read the plugin source and found out that it's actually manage_options. And it worked. tl;dr: $role_object = get_role( 'editor' ); $role_object->add_cap( 'manage_options' ); works for me ...


1

In a nutshell it is going to affect things, which has configuration specific to the current theme. Out of native functionality that would be most prominently: menus (which are assigned to theme locations) widgets (which are assigned to sidebars) This can go further if theme provides sidebars and custom widgets for example. Overall there are rarely ...


0

Wordpress usually adds the category as a class in the body/article tag of each page, you can probably style each category with a custom background through that class.


1

I do not know this theme. But you must use this two functions somewhere: get_theme_mod ('background_image', $default); set_theme_mod ('background_image', $_category_image_absolute_path); Maybe, you can define new modification names with this functions. For example, 'backgroud_image_entertainment', 'background_image_storysode', etc. (as is shown in the ...


0

The problem with your $item_info is that the variables is not initialized before your try to append to it. $item_info .= 'String content'; is the exacte same thing as $item_info = $item_info . 'String content'; so all you need is to check wheter or not this variable exist if (!isset($item_info)) { $item_info = ''; } $item_info .= '<div ...


0

You can use get_the_ID(); function in place of $post_id= 'your post id' so that you don't have to place the post id manually every time. The Function automatically gets the id of the post/page


1

I do not think this is technically feasible. In general case any plugin creating its own admin screens will be relying on admin-side conditionals (such is_admin()) and context (such as $hook_suffix, etc). Reproducing this in general at the front side will be fragile and nightmare. Simply put creating custom curated interfaces has little to do with exposing ...


0

So it could mean that's what the community likes about WordPress having things controlled from back end. WordPress doesn't necessarily have to be the solution for every problem out there. WordPress in essence is a content management system and an application frame work. We need to analyse if WordPress caters to our requirement. If it does then you have to ...


0

.animate() is the jQuery function you're going to want to have a look at. Very handy. Here's a working example for your particular question: http://jsfiddle.net/B8Yv9/ And a complete html workup: <!doctype html> <html> <head> <meta charset="utf-8"> <script type='text/javascript' ...


0

Try: add_filter('template', 'change_theme'); add_filter('option_template', 'change_theme'); add_filter('option_stylesheet', 'change_theme'); function change_theme($theme) { if ( wp_is_mobile() ) { $theme = 'SelectThemeMobile'; } $page = get_page_by_title( 'Title for 145' ) if ( is_page($page->ID) and wp_is_mobile()) ...


0

It is possible to add line breaks using &nbsp; in the "Text" view like so: https://cloudup.com/cb5PCT2sWRP One thing to be aware of is that once you add the HTML for non-breaking spaces, you must remain in the "Text" view for future edits; switching back and forth to the visual editor will remove the above code.


3

As the WordPress Codex for have_posts points out: As a side effect, have_posts starts, steps through, or resets The Loop. At the end of the loop, have_posts returns 0 after calling rewind_posts. Looking at the source as it stands today: along with calling rewind_posts() it also fires the loop_end action (which plugins may rely upon) as well as set a ...


0

You must be use in single post or detail post because you does not get post meta field. For example you have one custom post type like "Product" in admin side and than you add just custom fields to product(Extra filed such as price,number etc). In short you use while loop than you can get extra field like as get post meta otherwise you can not get extra ...


1

The theme editor is not available on multisite installations. Changing this would require modifications to WordPress Core, that would need to be remade everytime you updated WordPress. I STRONGLY advise against this. Also keep in mind that if one user edits a theme, everyone else using that theme gets the changes. There is only one copy. The editor also ...


0

Firstly, you should never use query_posts to construct custom queries. This is not just my emphasis, but the codex as well. The one big problem with query_posts is, it many circumstances, pagination fails Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. ...


-1

If you are using get_posts then you can use get_the_permalink(get_the_ID()) query_posts('cat=4&showposts=1'); if (have_posts()) : while (have_posts()) : the_post(); ?> <a class="heading-link" href="<?php echo get_the_permalink(get_the_ID(); ?>"> <?php the_title(); ?> ...


-1

YOU want to display one post for category id 4 ? if yes .PLs use below code <?php query_posts('cat=4&showposts=1'); if (have_posts()) : while (have_posts()) : the_post(); ?> <a class="heading-link" href="<?php the_permalink(); ?>"> <?php ?> <?php the_title(); ?> </a> ...


1

First of all, don't use query_posts; use a WP_Query object instead. The reason your links are not being displayed correctly is that the link (<a> tag) is not actually within the loop. <?php while ( have_posts() ) : the_post(); ?> <a class="heading-link" href="<?php the_permalink(); ?>"> <?php the_title(); ?> ...



Top 50 recent answers are included