[Support request] Pre_get_posts is a hook

Home Forums Support [Support request] Pre_get_posts is a hook

Home Forums Support Pre_get_posts is a hook

  • This topic has 1 reply, 2 voices, and was last updated 3 years ago by David.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #1141061


    I am using Generatepress + Elementor

    I am using a widget in Elementor to display content (I could use the “portfolio” widget of the “posts widget”). I want to display Posts + CustomPostType 1 + CustomPostType 2. This not a native option in Elementor, because the widget only lets you choose 1 query, but after doing some research I got to this article https://developers.elementor.com/custom-query-filter/#Multiple_Post_Types_in_Posts_Widget that says: “After you have set up the Custom Query Filter you can use it to modify the query in the same way WordPress native pre_get_posts hook lets you modify the Query. Using the Custom Query filter is just like any other WordPress native action hook”

    Thing is: I have created the Custom Query in the widget, but now I don´t know where I should write the provided code. Should I use Generatepress> Elements> Hooks?

    As far as I understood, I should be looking for the hook “pre_get_posts”, but I didn´t find it within Elements > Hooks.

    Could you please help me?
    Thank you in advance for your suppport!

    Customer Support

    Hi there,

    GP Hooks are only for inserting ‘content’ into the Theme Templates.
    Reading the Elementor Doc – you just need to add the functions ( once amended ) they provided to your child theme functions.php or use the Code Snippets plugin.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.