New answers tagged

0

I just found some kind of workaround. I set the right "edit options" for this user. To be honest I do not know what this right means, but the user is now able to edit all the posts - so the links now have a valid target (href) Strange behaviour. Somebdoy can explain this?


1

One option could be to use data attributes on the entires listed on pages one and two. Then attach a click event that reads the attribute value on click saves it to localStorage. This way you wouldn't need to make an extra db call on page three. In the loop the data attribute value can come basically from anywhere. E.g. post meta, some post field, taxonomy ...


0

In your theme's file functions.php: add_action('wp_enqueue_scripts','STACK_356524_add_css_js_on_page',99); function STACK_356524_add_css_js_on_page(){ global $post; if($post->post_type=='page') { // check if the current wp object is a `page` also is_page() can be used: see https://codex.wordpress.org/Conditional_Tags wp_enqueue_script( '...


2

Your content is there BUT hidden from view via CSS styles. Normally wouldn't provide an answer for this, but it may be helpful to others as it is not uncommong. This is usually due to CSS styles in external stylesheets, inlined in your <head> in of the html document (template header) OR more commonly as inline styles on your content which contain ...


1

Answer by @Pieter Goosen : If you need to update the page before the main query fires and returns the page object, you will manually need to parse the URL (probably on init) and get the page ID from get_page_by_title() or get_page_by_path(). Otherwise, 'wp' would be earliest hook to get the page ID, for example: function my_early_id() { $...


1

If you have your old database and uploads folder, you can install WordPress and give it that database. Then, you can use the wordpress importer/exporter to export the posts, then upload it to your new site using the same plugin. If your old site is much larger, it may even be easier to take an export of your new site, then upload the old sites database and ...


-1

Please for next time, try to save all your articles using Notepad or Microsoft word format. That is what I normally do in every of my articles that I write in other not to be stranded if I loss any of my sites with articles to publish. Thank you. Sammy Jnr


0

You can find here the solution: https://developer.wordpress.org/themes/basics/template-hierarchy/#category Rendering category archive index pages uses the following path in WordPress: category-{slug}.php – If the category’s slug is news, WordPress will look for category-news.php. category-{id}.php – If the category’s ID is 6, WordPress will look ...


0

$count = 0; $terms = get_terms( array( 'taxonomy' => 'post_tag', 'hide_empty' => true, ) ); foreach($terms as $term) { $term_link = get_term_link( $term ); $count++; <a href="echo $term_link" class="size-1"> echo $term->name </a>; if ( $count >36 ) break; }


0

for some reason the edit.php does not work at my setup 5.3 This however works remove_submenu_page( 'edit-tags.php?taxonomy=category', 'edit-tags.php?taxonomy=post_tag' ); remove_submenu_page( 'edit-tags.php?taxonomy=category', 'edit-tags.php?taxonomy=category' );


0

The only way I can think of to achieve this without any custom coding is if your theme already displays Category descriptions. When you edit a Category, there is a "description" field where you would place the static information. However, many themes don't display this information. So, if you try adding a Category Description in wp-admin and it doesn't ...


0

Since wordpress version 4.0 there is a wordpress core function attachment_url_to_postid that "Tries to convert an attachment URL into a post ID." But these function has huge flaw cos it can't convert custom image url sizes. Almost all top answers before trying solve these problem, but all of them have a very heavy database query trying to get all existing ...


0

I managed to come up with a solution myself. To get a list of posts of a specific post type one must wrap the wp.data.select( 'core' ).getEntityRecords() selector inside the withSelect higher order component, which is a function that provides props to a component using selectors. Then, we can populate a SelectControl with this data. export const settings = {...


0

This is general idea of how wp_insert_post works if(isset($_POST['submit']) && !empty($_POST['submit'])) $title = sanitize_text_field( $_POST['title'] ); $content = sanitize_text_field( $_POST['content'] ); $args = array( 'post_title' => $title, 'post_content' => $content, // this is your post content ...


0

You can user if..else condition to combine both function into one hook. add_action( 'transition_post_status', 'groupqueue_to_groupcpt_and_groupcpt_to_bannedcpt', 10, 3); function groupqueue_to_groupcpt_and_groupcpt_to_bannedcpt($new_status, $old_status, $post){ //Move to Group Post Type if ('publish' === $new_status && 'groupq' === $post-&...


0

Via Velvet Blues Update URLs Plugin You can also use the Velvet Blues Update URLs plugin. After installation, go to Tools> Update URLs. In the Old URL field we enter what we need to change, and in the New URL we enter what we need to substitute. As a result, you can change the permalinks from linking and to the site’s pictures, to relative ones.


1

Not really, but perhaps you using the wrong terms: A shortcode is a manually entered piece of text where code has been programmatically added so that when wp runs 'the_content' filter , it'll then call the function and replace the piece of text with the returned result of the function. It's a specialised form of a filter. It sounds like what you want is ...


0

In your sample code the $latest_posts is an instance of WP_Query class. If you want to get the latest post's date, you should do this: $latest_posts = new WP_Query( $args ); $last_date = ''; if ( $latest_posts->have_posts() ) { $latest_posts->the_post(); $last_date = get_the_date(); } return $last_date;


0

You can use additional WP_Query parameters like post_per_page For example, $my_custom_query_args = array( 'posts_per_page' =>1, 'orderby'=>'DESC'); $my_custom_query = new WP_Query( $my_custom_query_args );


Top 50 recent answers are included