New answers tagged

0

You can add inline js by using the wp_add_inline_script function. function prince_scripts() { wp_enqueue_script( 'prince-script', get_template_directory_uri(). 'main.js'); $hide_on_mobile = apply_filters( 'prince_hide_on_mobile', true ); $data = 'var hideOnMobile = ' . ( $hide_on_mobile ? 'true': 'false' ) . ';'; wp_add_inline_script( '...


0

if you want to display all child pages of parent page in the child page then you can try this. it will display child page title and its links. $current_page_id = get_the_id(); $parent_id = wp_get_post_parent_id( $current_page_id ); if(!empty($parent_id)) { $child_args = array( 'post_type' => 'page', '...


-1

Yes, if they are public pages WordPress will let them be indexed unless you tell it not to. Try adding this to you function.php this: function allow_no_robots() { global $post; if ( $post->ID == PAGE_ID_TO_NOT_INDEX ) { echo '<meta name="robots" content="noindex, nofollow">'; } add_action( 'wp_head', 'allow_no_robots' ); That ...


0

Thank you everyone for these suggestions ! I wanted to set "Elementor canvas" template by default on post only and I did like that : function default_post_template_elementor_canvas($post_type, $post) { $wishedTemplate = 'elementor_canvas'; // to see available template var_dump(get_page_templates($post)) if ($post_type === 'post' &&...


0

Your can use post_parent parameter for your query. Ref: https://codex.wordpress.org/Class_Reference/WP_Query This will change your query to: $args = array( 'post_type' => 'b_books', 'order' => 'ASC', 'orderby' => 'date', 'posts_per_page' => 10, 'post_parent' => 0 ); genesis_custom_loop( $args );


0

This is me but I now have a login. I password protected the page by creating a new page then clicking password protected under visibility.


0

Found a simple solution without changing any code. I have used another plugin Popup maker that will create a pop-up, there I can configure on page load / with time delay.


2

If you use WordPress author template to show user posts ( example.com/author/{user_name} ) the best solution will be to change the main query via the pre_get_posts filter hook. function se339534_author_any_post_types $query ) { // apply changes only for author archive page if ( ! is_author() || ! $query->is_main_query() ) return; $...


0

You might get away with shortcodes: add_shortcode('title', function ($atts, $content = null) { $atts = shortcode_atts([ 'id' => null, ], $atts); $title = ''; if (!empty($atts['id'])) { $title = get_the_title($atts['id']); } return $title; }); add_shortcode('content', function ($atts, $content = null) { $...


0

I'm not sure if this is what you mean but this Wordpress function can display list of authors: wp_list_authors( $args ); https://codex.wordpress.org/Function_Reference/wp_list_authors You can use this one to display the posts of an author: https://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters The author is the parameter.


0

You could use these plugins: https://wordpress.org/plugins/custom-sidebars/ https://jetpack.com/support/widget-visibility/ Both allow you to control which widgets/sidebars show up where.


0

If you write code... Step 1. Find and edit every post you want to assign to a page and give them all either: 1) The same Category, 2) The same Tag or 3) The same post metadata Step 2. On that page's template or in a custom block or widget write a WP_Query that gets the posts (by tag, category or post meta) and displays them on the page in the format you ...


0

İ found a solution: $posts = get_queried_object(); echo $posts->count;


1

From the documentation, you have to use the shortcode: [fc id='12' type='popup'][/fc] Next, something has to trigger the form, you can create a button for that and then click it from jQury, edit the link which would trigger this form, and put the href or hyperlink to: <a class="triggerForm" href="http://yoursite.com/form-view/12">Link Trigger</a&...


0

Actually, it was a theme, issue, I just changed the theme to something more simple and it is now working. Hope this helps someone!


Top 50 recent answers are included