jlgallego99
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Create a custom page with a plugin on a block theme?I finally solved it, the problem was in my template, my theme uses a template-canvas.php file located on wp-includes that creates all the skeleton for the template and then inserts the content. Now my template looks like this:
<!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo('charset'); ?>"/> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <?php wp_body_open(); if (wp_is_block_theme()) { block_template_part('header'); } else { get_header(); } echo 'My content'; if (wp_is_block_theme()) { block_template_part('footer'); } else { get_footer(); } wp_footer(); ?> </body> </html>
Forum: Developing with WordPress
In reply to: Create a custom page with a plugin on a block theme?Perhaps there’s a better way to do all this? All I want is for my plugin to create a custom endpoint and insert some HTML content there, regardless of what theme the site is using
Using the template_include filter on a block theme loads my template first, and then loads the home page of my site at the bottom. I’m using twentytwentyfour theme btw
- This reply was modified 9 months, 2 weeks ago by jlgallego99.
Forum: Developing with WordPress
In reply to: Create a custom page with a plugin on a block theme?Hi @zex2911 thanks for your input. As block_template_part is a void function, I had to check with the wp_is_block_theme() function. With that it works on a block theme, but I’ve noticed that the template doesn’t load any css. When I change to a normal theme, the CSS is loaded, but on a block theme the CSS is not loaded in either header, footer or my custom content
Forum: Developing with WordPress
In reply to: Avoid uploading duplicates with media_sideload_imageIsn’t there another way? That automatic response didn’t help me, the attachment ID is different each time even though the URL is the same
Hi, thank you for your response, I think I will go with the additional CSS way as I didn’t know that will take precedence over my own stylesheet without discarding it and that’s exactly what I wanted. I also thought the user can define its own CSS file on its WP theme, and the plugin only needs to search for it and enqueue it after the main CSS file. I’ll mark this as resolved
Forum: Plugins
In reply to: [The Events Calendar] ORM can’t create event with featured imageAny leads? I see that I can manually create the image and get the ID, but if I create two events with the same image, that will mean duplicated images. Isn’t there a way to do it within the events calendar ORM automatically?
Forum: Plugins
In reply to: [The Events Calendar] Get event meta field after creating an eventFor now, I have solved this by adding the wordpress meta_field field when creating the event like this:
$args['meta_field'] = array( 'my_meta_field' => "something" ); tribe_events()->set_args($args)->create();
And now I’m able to get the metadata on the save_post hook
Forum: Plugins
In reply to: [The Events Calendar] Get event meta field after creating an eventI noticed now that this happens because I update the meta field after I create the post, that’s why the meta field isn’t there on the save_post hook. I wonder if there’s a way on the ORM to create the event with my custom field on one go?