Custom Data

Besides a plethora of options, SleekPixel allows you to add custom entries to the dynamic data dropdown in the editor. This can be achieved using the sleekPixel/data/custom filter.

functions.php

            add_filter(
      "sleekPixel/data/custom", function ($data, $args) {
        $postId = $args["postId"];

        // Add custom data entry 1
        $data[] = [
          "value" => "customData1",
          "label" => "Custom data",
          "data" => get_field('my_field', $postId),
        ];

        // Add custom data entry 2
        $data[] = [
          "value" => "customData2",
          "label" => "Custom data 2",
          "data" => "My custom title #2",
        ];

        return $data;
      }, 10, 2 );

      
Copy