0

I've looked around in StackExchange & elsewhere before asking my question directly:

I have created a Wordpress custom template which users can add job-vacancy posts to.

I want to display these posts as part of front-page.php in the same website _ I think the best way to do this would be an iframe format but I have read that, for security reasons, Wordpress negates <iframe></iframe>

Is there a way to achieve this effect without using a Wordpress plug-in? and what would the dynamic code be inside the iframe src element?

Thanks in advance for any pointers

  • If you created a job-vacancy posts section in Wordpress site, presumably with custom post types, within front-page.php you can use get_posts() to retrieve your posts, run a loop and display them. If that doesn't sound right, please expand as to how you initially setup these posts you want to display. – David Sword Dec 19 '17 at 23:35
  • I had thought to use a custom page rather than custom posts David, though now you have mentioned get_posts() option, I can see that would probably be an easier solution _ Many thanks for your input – inputforcolor Dec 19 '17 at 23:47
  • 1
    custom page? you mean a normal Wordpress page? If thats the case: you're after getting post_content from one page on another. Say the ID of the source page was 42. Within the destination front-page.php file, you could do something like: echo apply_filter('the_content',get_post(42)->post_content); – David Sword Dec 19 '17 at 23:57
  • or "custom page" being custom coded php page? If thats the case then you need to think about code reusability - wrapping the data of the custom page in a function(s), then putting those function in functions.php, then using said functions it both your "custom page" and on the front-page.php. (forgive the peppering of posts - I'm trying to grasp the problem without seeing what this 'custom template job-vacancy posts' page is or how its coded) – David Sword Dec 20 '17 at 0:12
  • i really appreciate your input David! : ) To be honest i'm just trying to make things as simple as possible for my client _ I'm fairly certain the easiest method will be getting them to add a category to the post then simply displaying that, as per your first suggestion _ I got locked into the iframe idea and the posts solution evaded me _ Thanks again – inputforcolor Dec 20 '17 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.