WP Loop not pulling correct info - custom-wordpress-pages

I am trying to make an accordion for a question and answer section. The code works, however, when I try and place it into the WP Loop I am encountering problems. The loop is pulling the correct posts, but is only showing the answer for the latest post, regardless on which post I select. I assume the problem is with my code in lines 29-33.
screenshot

Are you sure all the answers are also in the 'post_type' => 'faq' ?

Related

ACF Post Object in ACF custom block using timber/twig

I realize this is vague, but documentation is slim. Trying to get any data from either a post object field or relationship field to appear in a custom block using timber/twig. If it's on the first 2 pages of Google results, I likely tried it with no luck. My other custom blocks I don't have to create a corresponding php file, just a twig file that's pulling data from a single, simple setup for all custom blocks. Repeaters, Groups, Galleries, no problem. Post Objects or Relationships, bupkis. Any help appreciated.
official documentation did nothing: https://timber.github.io/docs/guides/acf-cookbook/#relationship-field.
Found this and it resolved my problem. I'll be back to post a full breakdown so the question and answer are actually useful to others.

How do I check if certain text exists on a page (puppeteer)

Sorry in advance if I seem kinda clueless, I just started using puppeteer yesterday and I’m inexperienced with this kinda stuff.
I’m trying to check if a certain page (opened with puppeteer) has the phrase “hello” for example, keep in mind that I know the XPath of the text (if it exists). I’ve tried .waitForXPath() but I can’t seem to get it to work. Is there an easier function for this?
(await page.content()).match('hello')
That depends on what you typed into .waitforXPath() method.
I can imagine this can work:
await page.waitForXPath("//*[contains(text(), 'hello')]");
But it might be slow because all texts of all elements will be searched. It's better to narrow down the search to e.g. some elements. Unfortunately you don't provide more specifics, so I can't help you there.

How to get a link to a gitlab comment (inside a merge reqeust) that I wrote?

edit: Clarified that comments are in the context of a merge requests.
screen shot: available icons on right of one of my merge request comments
This screenshot shows a fragment of a merge request comment (not publicly available) that I wrote, note lack of vertical "three dots" on right as shown in Sakura's screen short below. My just shows a pencil for editing.
I want to reference arbitrary discussion comments on some source code in merge requests.
edit: generalized my "my comments I created" to "general comments", added screenshot of an example from gitlab:
screen shot: example comment from publicly accessible gitlab merge request #523
Here is a publicly visible merge request at gitlab.com, I just chose this merge request at random because it had a fair number of comments. I chose this particular comment more or less randomly, and because the associated code fragment was short.
If you search that merge request for this text you'll find a discussion matching the above comment.
Toon Claes OOO
#toon started a discussion on an old version of the diff 1 month ago
Resolved by Toon Claes OOO 1 month ago
Original description:
Let me explain what I mean by link.
Gitlab sends me an email when other people make discussion comments, like
this example from a merge request discussion:
(i) | Samantha Q. commented on a discussion about a/b/c/foo.py:
| 123 - # some ugly code
| 123 + # some cleaner code
| Some insightful comment here.
The a/b/c/foo.py in (i) above is a hyperlink like this:
a/b/c/foo.py
Which is sort of ok for comments other people write, because I can copy the link from the email (assuming I still have it). But I don't see a way to get this kind of link from discussion comments anybody wrote (originally emphasized comments that I wrote).
Can you tell me how to get a link like (i) from the gitlab user interface?
workaround: I can manually hack up a link by digging the note id #note_18536 part out of view source, but that seems harder than it needs to be.
edit: also, this work around doesn't appear to work on possibly newer version of gitlab becuase when I go to search for the comment in view-source I can't find it, I don't know why - maybe it is dynamically populating the page via javascript.
On gitlab, when you wrote a comment, you have a menu on the right of the comment header (see image):
On these menu, you have two options:
If you're the poster, you have the option for copy link, and delete comment.
If you aren't the poster, you can report comment, or copy link.
I think that's resolves your question.

Post revisions don't save or show up for all custom post types

My website makes use of a number of custom post types as well as the traditional "posts" and "pages" types. For all "posts" and "pages" revisions show up as they should, with a history of edits visible, the option to compare posts, and so on. For all custom post types, I have no revision history at all. I've enabled revisions when defining each of these post types in functions.php, so on each of these post types I get a blank tab that says "Revisions" but does not display or collect any revisions data.
I'm at a loss for how to fix this and any help would be appreciated!
Thanks in advance for any assistance.
I could post my functions.php file if it helps solve this... just ask.
I know this is an old Q, but just had the same problem and fixed it...
In your custom post type args array (in functions.php) add 'revisions' to the 'supports' array:
$args = array(....., 'supports' => array(..., 'revisions'),......);
Note however that this wont take effect for old pages of this post type, just new ones created from now on
If you're doing anything to do with custom post types, this article is awesome.
As far as I know, Wordpress by default does not store revisions for custom post meta. However, there is a great article on how to add revisions to post meta http://lud.icro.us/post-meta-revisions-wordpress/
I was having the same problem where none of the obvious answers worked. I added an answer to the same question on WPSE: https://wordpress.stackexchange.com/a/109782/11966
It was frustratingly simple...

Google docs viewer url parameters

Is there any sort of documentation on exactly what parameters you can put in the url of Google viewer?
Originally, I thought it was just url,embedded,chrome, but I've recently come accross other funny ones like a,pagenumber, and a few others for authentication etc.
Any clues?
One I know is "chrome"
If you've got https://docs.google.com/viewer?........;chrome=true
then you see a fairly heavy UI version of that doc, however with "chrome=false" you get a compact version.
But indeed, I'd like a complete list myself!
I know this question is very old and perhaps you already solved your issue, but for anyone on the internet who might be looking for an answer...
I have been looking for this recently, following a guide I found on GitHub Gist
https://gist.github.com/tzmartin/1cf85dc3d975f94cfddc04bc0dd399be
More specifically, the option to embed a certain page of pdf using
<iframe src="https://docs.google.com/viewer?srcid=[put your file id here]&pid=explorer&efh=false&a=v&chrome=false&embedded=true" width="580px" height="480px"></iframe>
The best I could fing was this article (I suppose from a long time now)
https://weekly-geekly.github.io/articles/111647/index.html
HOWEVER, I tried modifying the attributes and the result was simply a redirect to
https://drive.google.com/file/d/[ID]/edit
https://drive.google.com/file/d/[ID]/preview or
https://drive.google.com/file/d/[ID]/view
AS OF MAY 2020, THIS SOLUTION PROBABLY DOESN'T WORK
I'm also on a quest to discover some of the parameters of the viewer.
the "chrome" parameter doesn't seem to do anything, though. Is this
supposed to be the same as embedded=true?
Parameters I know of:
url= (obviously)
embedded= (obviously)
hl= set language of UI (tooltips)
#:0.page.1 = jump to page 2 (page 1 is numbered 0) - this is unreliable and often requires a refresh after the first load,
defeating the purpose.
That said, when I use the Google Docs viewer on my site, "fit page to
screen" is the default view without any parameters. So maybe I'm
misunderstanding your question.
Source: For convenience, this is a full quote of the sole answer (it is from user k3david) to the crosspost of this question #Doc has posted to the Google support forum in 2011.
You can pass q=whatever to pass a search query to the viewer.

Resources