Tag Info

New answers tagged

0

Try the following: Disabled all plugins, removed plugins folder entirely - problem still persists. Removed the .htaccess file - problem still persists. Tried a fresh install - problem still persists. Cleared browser cache. Checked the server for any auto updates - there haven't been any. Changed the autosave to various times define( ...


0

If you can count on the URI always following the same pattern, e.g. /link/###, then you can selectively load a different template using a query variable and a rewrite (will need to flush rewrites to test): /** * Register a query variable to check against for loading a template. * * @param array $vars Registered query variables. * @return array (Maybe) ...


1

The WP function get_attached_media() should provide the info you need. If used in this way... $media = get_attached_media( 'image' ); ... the $media var should contain the wp_post objects for all attached images. Function documentation in the WP Codex: https://codex.wordpress.org/Function_Reference/get_attached_media


3

I was curious about this and checked the Codex on keyboard shortcuts, but didn't find it mentioned there. I searched and found out that this seems to be already solved, e.g. here and here. I haven't tested out these other plugins so I'm not sure how they solve it, but I decided to take on the challenge and see how this could be solved ;-) So here's my ...


1

I would not try to get too tricky and hide pages from users. What happens if they try to create a page with the same slug? I think it would just create confusion and more problems than it would solve. When you create the pages, store their IDs, not slug. Let users then change those through your options screen. This is similar to how WordPress tracks your ...


0

You could create a custom post type of "Static Pages" that do not allow you to update the titles. remove_meta_box( 'post_title' , 'your_custom_post_type', 'normal' ); remove_meta_box( 'slugdiv' , 'your_custom_post_type', 'normal' ); Then add in your static pages programmatically with wp_insert_post(); and force the slug and post_title to what you want. ...


-1

you can do it by adding below code.it will give you current page id. $postid = get_the_ID(); echo $postid;


0

The solution was straightforward, though it took me forever to find it. The website has a "Members" plugin (by Justin Tadlock) and the option "Redirect all logged-out users to the login page before allowing them to view the site." was checked. So I just unchecked that box, problem solved.


1

For me the problem would be to use a plugin that uses evil() eval() to evaluate string as PHP, in the first place ;-) This part is from the PHP manual: Caution The eval() language construct is very dangerous because it allows execution of arbitrary PHP code. Its use thus is discouraged. If you have carefully verified that there is no other option ...


1

You could use this search and replace tool: search and replace by interconnectit Apart from that you could put some redirects in your htaccess, but really the search and replace works great.


0

Remove the true parameter in the get_permalink function $url = get_permalink( $post_id );


1

Hameedullah's answer is more elegant, but doesn't eliminate the before and after items. To do that, you need to filter get_edit_post_link instead, and return null. function wpse_remove_get_edit_post_link( $link ) { return null; } add_filter('get_edit_post_link', 'wpse_remove_get_edit_post_link');


2

I managed to solve this myself. Instead of using register_sidebars() to register the sidebars all together, I simply used the singular register_sidebar() in a for loop, so that it registered a sidebar for every matching page. All one would need to do to get this working is change the template name (in my case template-generic-sidebar) to their own template ...


0

Go to dashboard Then go to Appearance -> Menus. Now you have menu dashboard open. Now create a menu by writing name of menu and click create. After that add page to that menu by clicking check-box of page and then add. After adding Assign it to primary menu by clicking the check-box at bottom then save menu. Also read wordpress.org documentation


0

You need add page 'About' into Menus in WP. That show page 'About' on navigation.


0

I have not tested this, but it may work. The template is chosen based on a value in the global post object, so we need to change that value in the post object before the metabox is rendered. The code which chooses the default dropdown is here: https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/meta-boxes.php#L751 ...


0

This is completely untested but I believe you would want something along these lines: <?php if( $loop->have_posts() ): while ( $loop->have_posts() ): $loop->the_post(); // Do stuff for results echo '<h2>' . the_title() . '</h2>'; // Check for tag if(has_tag($tag) { output HTML if true } endwhile; ...


0

10up engineering best practices as a great example on how to achieve that. You basically add a new rewrite tag and a new rewrite rule and then using the template_redirect action you return your custom action. Here is the code: add_action( 'init', function() { add_rewrite_tag( '%model%', '([^/]+)' ); add_rewrite_rule( 'cars/([^/]+)/?', ...



Top 50 recent answers are included