I finally found the problem, in fact when you add pagination to visual composer post-grid shortcode, it will use ajax to load the things. But to communicate to the ajax php script it uses the post id.
The problem is that the shortcode will have no post id if you create it live, or another post id if you use an external post as a model.
Then to make it works, I first create a page with the short code I want, then in my other page I get it contents like that :
$post = get_posts(array( 'name' => 'my-page-slug','post_type' => 'page'))[0];
print do_shortcode($post->post_content);
Notice the $post
that is a global variable used by visual composer and that now have the correct post ID.
Related Posts:
- Function to return true if current page has child pages
- How to determine if WP_DEBUG is enabled? [duplicate]
- Get author full name
- How to export/import theme customizer settings?
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- How to get the registered sidebar’s name by its id?
- is there a simple way to list every templates / php files used to generate a specific page?
- One button to change all settings in theme customizer?
- How to use copy() function and paste file in /wp-content/themes directory
- Dynamically loaded Theme components based on Customizer Settings values : changes not appearing in Customizer preview – (Workaround found)
- How can I add a class to a single menu item?
- Show different Customizer Settings on Page-Tamplates
- I think emoji are killing my WordPress site… How can I debug?
- How do I list the_tags() into HTML data-attribute
- Am I not understanding plugins?
- Using Font Awesome as post thumbnail
- Custom Logo URL | Help me print the URL of the custom logo I inserted into my theme
- Why is this Ajax not working?
- How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)
- custom shortcode will not display the wrapped content
- Displaying theme options in css
- max_input_vars: how many am I using?
- Using a variable in is_page(array())
- Trigger popup in a php if/else statement
- Anyway to output the registration form like the login form with wp_login_form()?
- How to load a template-part based on a url wildcard?
- Where to edit the template that is generating the code for dynamic_sidebar left-sidebar in the Understrap theme? [closed]
- Multiple WordPress Menus that will only display all pages
- How can I create a list of page titles from custom meta values?
- Custom theme: Alternatives to long list of ‘include’ in functions.php
- How to show part of the_content?
- get_the_tags() not iterating through for/while loop, but will with foreach
- Hide categories that are not used in the post type
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- post created but no permalink
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Menu jumping when calling it via PHP
- Trying to retrieve post meta
- Is there a way to conditionally check whether a WordPress post title is empty?
- Use .php file as page instead of wordpress page & template file?
- Use WordPress function in php file
- How to set up a If is_singular statement?
- Underscore – Self hosted fonts
- Get title attribute from galleries
- Why in my theme I can’t see all the statics content under the posts?
- Theme not calling Jquery properly
- How can I use a sliced image As banner? [closed]
- Double Curly Brackets in Php
- How to make function appear in sentence?
- Widgets not showing on custom theme
- Get post categories
- Get all posts as an array ID => Name
- How to modify mobile nav menu text in theme
- Output only links using wp_nav_menu()
- How to add aria role and schema markup to custom walker container
- jQuery accordion menu
- Removed jQuery script from header.php , any problems?
- How to get my [shortcode] rendered on the home page, other pages are fine
- Using php inside javascript [closed]
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Why in this WordPress theme I can’t see the Main Menu?
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- Get options from database using php class
- Trying to change featured image from 180×180 to full width on home page
- Remove the Tag from wp_nav_menu
- WordPress redirects page query parameter in URL
- Getting text from custom field from customizer
- WordPress navigation wont appear with wp_head
- Need help for some PHP code
- How do you get the current post taxonomy so I can get the current post taxonomy? into a variable to THEN loop through all post with that taxonomy.,
- how to replace h1 entry title with h2 in category pages only
- WordPress single.php get_header not working
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- Unable to retrieve get_author_posts_url
- Display post date also if the date it’s the same for each post
- Submit remote form to wordpress REST API and save data to custom post type
- alternate left – right content inside the loop
- Store user form submitted information in post type
- Add a custom link to each image in WordPress gallery
- register dependency css and js inside a plugin class
- WordPress files break if I edit them, but adding a closing PHP tag fixes it
- Collapsible menu on post sidebar only expands and does not collapse
- Woocommerce variable products are being added to the card on the homepage (ajax)
- How to get php file based on URL in WordPress
- I want different post-thumbnail size depending on media size
- Create a custom theme-specific page, invisible in the admin-panel?
- Not able to get the exact URL of the file on server located in active wordpress theme
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- Image not displayed
- need help to arabic text in wordpress
- Adding code to the function file
- How to implement conditional PHP in Footer
- Adding php within a return statement [closed]
- Using is home to get content [closed]
- How I can give a php page a style from my theme
- Pagination not working properly
- How can I fix my pagination?
- Variable ++ in query loop
- functions.php doesn’t load all custom theme assets