English 中文(简体)
How Do I Intercept Banner in WordPress?
原标题:

My client wants me to make a plugin that intercepts the banner on a WordPress blog so that the existing one displays, but right beneath it, above the content and the sidebar, another banner appears. And he needs it such that it works in most themes and isn t theme-specific.

I found I could use add_action( loop_start , interceptMe ) to put something at the top before posts or a single post, but it still left the sidebar on the right. I have tried using add_action( all , test ) to dump out different intercepts to see if I could figure this out, but I just can t seem to get it yet. I m thinking I may have to intercept all esc_html calls and contextually inspect that until I find one used for the banner.

Does anyone know how to intercept the banner to add another one right beneath it?

最佳回答

This is going to be very challenging to do. There s no consistent structure, HTML, or CSS IDs that would allow you to do cross-theme injection like this (hell, some themes don t have a header image). You will likely need to make manual changes to each theme for this.

问题回答

I suppose you might insert some JavaScript that looks for an H1 tag and inserts your banner right after it. Ceejayoz is right though -- there s not consistency to different themes. One theme might use H1 for the site header and another for a Post title.





相关问题
How to suppress/remove PHP session cookie

I need to suppress an already set session cookie header, but I cannot find any way to do this. Why? I need to make an image, sent by a PHP script, cacheable by the end user; this image is used to ...

Why is my page still executing?

I have a form that posts to a processing script which checks for errors in the post. Depending on the processing it header redirects to another location. This appeared to work but I have just noticed ...

How to stop floating (sliding) div at footer

How can I have a sliding menu div that doesn t move unless the page is scrolled down past a certain point I used the code from this link for a floating menu. it has how to stop the stop float at ...

Better way to share header file between separate vc project?

How would you organize your vc projects source code to share the same header file? put the header in a common folder, and have every vc projects include it. put the header in a vc project, and have ...

how to tell clicking "back" to load cache?

I would like for my site when someone clicks "Back" or "Forward" for the server to tell the browser to load the cache instead of reloading the entire page. I ve tested some headers and done research, ...

热门标签