New answers tagged

1

Your code is invalid (syntax error, missing closing array and semi-colon), and incorrectly nested - if you were to properly indent your code, you'd have something like: $args = array( 'tag' => 'tag-AAA,tag-BBB', array ( 'orderby' => array( 'title' => 'ASC', 'post_date' => 'DESC', ...


0

If you're already experienced with HTML & CSS, then I'd suggest starting by building pages the way you'd like them and then looking at https://codex.wordpress.org/Template_Tags to see how you can replace key sections of the pages dynamically from WordPress.


16

Here's a way to support pagination titles of the form: <!--nextpage(.*?)?--> in a simlar way as the core supports <!--more(.*?)?-->. Here's an example: <!--nextpage Planets --> Let's talk about the Planets <!--nextpage Mercury --> Exotic Mercury <!--nextpage Venus--> Beautiful Venus <!--nextpage Earth --> Our Blue ...


5

You can use filter wp_link_pages_link First pass our custom string placeholder (This can be anything you like except string containing %, just for now I am using #custom_title#). wp_link_pages( array( 'pagelink' => '#custom_title#' ) ); Then add our filter in functions.php. In callback function make an array of titles then check for the current page ...


0

You have some very confusing information in your post. Wordpress has 3 different types of pages to reference and from some of your URL structured references you might be adding a 4th. First Wordpress page is the "Page" which you can create from within the Wordpress dashboard. Second is the page in which it displays on (this really depends on your theme). ...


0

This question isn't really great, as it's well documented in many places, but the answer is: View the page source, and look in the "open" body tag. It should show something like: <body class="single single-post postid-29654 ... > This example the page id/post id is 29654


0

Why not build a blog style website first? If you're new to WordPress, it's better to start with something relatively easy, where there are lots of tutorials for. Practicing will give you the skills to reach for something higher, like the list of ambitions you give. If you need all those things you say right now, you're better of with buying a decent ...


1

You can try this: add_filter( 'media_send_to_editor', 'remove_width_height_attribute', 10 ); function remove_width_height_attribute( $html ) { $html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); return $html; }


0

You can use jQuery for this: $('object').each(function(){ $(this).removeAttr('width height'); }); That should remove those attributes for you. You can even set attributes as well if need be. Put the following inside the function above (Obviously you can change the attributes as need be). $(this).css('max-height',500);


2

Programmatically, you'd be looking for is_user_logged_in(). You'd want to put this in your header.php, or on the page itself: if ( is_user_logged_in() ) { // user logged in, redirect // One way to redirect is: // wp_redirect('http://YOURSITE.com/'); exit(); } else { // user not logged in, nothing } Otherwise, if you're just looking ...


2

I think @Milo's comment is correct. Presumably you want to use functions like current_user_can(), etc. Alternatively, if this is just to show a different menu, you could create a custom menu for remote users then set a cookie on your wordpress site (via a call from the API) and display a different menu to your remote users when authenticated remotely. ...


2

First off, ensure that the category is exactly the same name as the page ( slug and all ). Secondly, the parameters you're passing to WP_Query is incorrect. category_name expects a slug. For example, Page 1 would have a slug of page-1. get_the_title() pulls the current page title - so you're passing Page 1 to a parameter that expects a slug page-1. What ...


0

sounds like a .htaccess issue use a standard theme - still got the error? yes --> investigate your .htaccess file in the root of your site is the rewrite module loaded --> check with phpinfo() on your local server no --> investigate a .htaccess file within the template directory in both cases: check the rewrite rules within the .htaccess file


0

I started this in a comment but thought I'd expand it for you because I do like the question ;) I'd probably tackle this by adding a hidden field to the search form with the current page ID, and then using the pre_get_posts filter to modify the search query to only return pages with a matching parent. However: I don't think we can deal with an additional ...


1

In a theme with no menu locations defined - or a Wordpress install with no menus set up - the default fallback option for menus is to display the output of wp_page_menu(). By default, this will output all of your pages firstly by their order, then by their title if the orders match. This makes it simple to avoid the extra step entirely of configuring a ...


-2

RESOLVED!! It was me missing a trick within Role Scoper. All sorted! Thanks Mukto90 and Monkey Puzzle for your input. Cheers! Andy


-2

<?php global $post; $child_pages_query_args = array( 'post_type' => 'page', 'post_parent' => '93', 'orderby' => 'date DESC' ); $child_pages = new WP_Query( $child_pages_query_args ); ?> <?php if ( $child_pages->have_posts() ) : while ( $child_pages->have_posts() ) : $child_pages->the_post(); ?> <div ...


0

More modern way to do that, it should work even when the wp-login URL is changed by plugins and when WP is in a subfolder, etc: if(stripos($_SERVER["SCRIPT_NAME"], strrchr(wp_login_url(), '/')) !== false){ /* ... */ }


1

Solved I've solved the problem and I'm going to share the code I used, so other developers that have this issue too can cope with it. The get_pages()-function accepts the "hierarchical" argument. By default it's set to 1 (true), which means, that Wordpress searches the pages in hierarchical order to find the other parameters. If - as in my case - you ...


0

By removing the capability of deleting published pages and publishing pages, I have effectively stopped the admin from creating or deleting anything that is on the website. $role = get_role('administrator'); $role->remove_cap('delete_published_pages'); $role->remove_cap('publish_pages');


0

Adminimize does not remove menu items etc, it just keeps them visually hidden. In other words, your admin pages is still accessible. Add this code to your functions.php file: add_action('admin_menu', 'edit_trustees_page'); function edit_trustees_page() { global $submenu; $trustees_page_id = 1; //change this value $url = get_admin_url() . ...


1

http://wordpress.stackexchange.com/a/199997/86773 As the advice suggested here, switching my hook to "wp" instead of "init" allowed me to make the page comparison I wanted using is_page().


0

Have you tried get_the_ID function? Try this one to get the ID and after that you can get all the info you want. Does it help?


1

I use the following for multiple post types, just replace foo and bar with your own post types: $args = array( 'post_type' => array( 'foo', 'bar' ), 'orderby' => 'post_date', // other parameters as needed ); $q = new WP_Query( $args ); if ($q->have_posts()) : while ...


0

If achieving this with a plugin is acceptable to you, an answer to a similar question recommended the Advanced Access Manager plugin.



Top 50 recent answers are included